/* ==========================================================================
   Chat Refresh — 统一首页深空/毛玻璃/银色质感主题
   覆盖 chat.css 中的视觉样式，保留所有功能性 class/ID 不变
   ========================================================================== */

/* === 根变量覆盖：去除青色，改用银白色系 === */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0c;
    --bg-sidebar: rgba(10, 10, 12, 0.72);
    --bg-input: rgba(18, 18, 20, 0.65);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);
    --accent: #ffffff;
    --accent-hover: #f0f0f0;
    --accent-light: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #10b981;
    --thinking-color: #fbbf24;
    --search-color: #34d399;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.8);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   全屏沉浸与悬浮 UI (Toolbar Replacement)
   ========================================================================== */

.content-area {
    padding-top: 0 !important;
}

.float-mobile-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(20px);
}
@media (max-width: 768px) {
    .float-mobile-btn {
        display: flex;
    }
}

.top-model-capsule {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 12px;
    background: rgba(20, 20, 22, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}
.top-model-capsule:hover {
    background: rgba(30, 30, 32, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.top-model-capsule .model-selector-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}
.top-model-capsule .current-model-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

.top-action-wrapper {
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 100;
}
.top-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(20, 20, 22, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.top-action-btn:hover {
    background: rgba(30, 30, 32, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.top-action-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 260px;
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top right;
}

/* === 左上角控制台 (历史/新建) === */
.top-left-console {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    background: rgba(14, 14, 16, 0.65);
    backdrop-filter: blur(32px) saturate(150%);
    -webkit-backdrop-filter: blur(32px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 4px;
    z-index: 90;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.top-left-console:hover {
    background: rgba(20, 20, 24, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

.console-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.console-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.console-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
}

/* === 历史记录抽屉 === */
.history-drawer {
    position: absolute;
    top: 0;
    left: -320px; /* 默认隐藏在屏幕左侧 */
    width: 320px;
    height: 100%;
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 95;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
}

.history-drawer.open {
    transform: translateX(320px);
}

.history-drawer-header {
    padding: 24px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-drawer-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.history-drawer-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.history-drawer-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.history-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: none;
}

.history-drawer-content::-webkit-scrollbar {
    display: none;
}

/* === 左上角控制台 (历史/新建) === */
.top-left-console {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    background: rgba(14, 14, 16, 0.65);
    backdrop-filter: blur(32px) saturate(150%);
    -webkit-backdrop-filter: blur(32px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 4px;
    z-index: 90;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.top-left-console:hover {
    background: rgba(20, 20, 24, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

.console-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.console-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.console-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
}

/* === 历史记录抽屉 === */
.history-drawer {
    position: absolute;
    top: 0;
    left: -320px; /* 默认隐藏在屏幕左侧 */
    width: 320px;
    height: 100%;
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 95;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
}

.history-drawer.open {
    transform: translateX(320px);
}

.history-drawer-header {
    padding: 24px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-drawer-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.history-drawer-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.history-drawer-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.history-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: none;
}

.history-drawer-content::-webkit-scrollbar {
    display: none;
}

@keyframes popoverFadeIn {
    0% { opacity: 0; transform: scale(0.95) translateY(-10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.action-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
}
.action-grid-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-grid-item svg {
    color: currentColor;
    transition: all 0.2s ease;
}

.action-grid-item:hover svg {
    transform: scale(1.1);
}

.action-grid-item span {
    font-size: 12px;
    font-weight: 500;
}

.action-grid-item.danger-item:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* === 新功能菜单：渐变描边卡片（一排两个） === */
.action-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: none;
    text-align: left;
    width: 100%;
    color: inherit;
    font: inherit;
}

/* 渐变描边 */
.action-menu-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: background 0.3s ease;
    pointer-events: none;
}

.action-menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: scale(1.02);
}

/* hover时彩色渐变边框 */
.action-menu-item.item-blue:hover::before    { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.action-menu-item.item-indigo:hover::before   { background: linear-gradient(135deg, #6366f1, #818cf8); }
.action-menu-item.item-amber:hover::before    { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.action-menu-item.item-emerald:hover::before { background: linear-gradient(135deg, #10b981, #34d399); }
.action-menu-item.item-cyan:hover::before    { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.action-menu-item.item-rose:hover::before    { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.action-menu-item.item-violet:hover::before   { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

/* 图标 */
.action-menu-item .menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.action-menu-item:hover .menu-icon {
    transform: translateY(-4px) scale(1.1);
}
/* 深色模式 hover：图标彩色发光 */
.action-menu-item.item-blue:hover .menu-icon    { box-shadow: 0 0 20px rgba(59,130,246,0.5); }
.action-menu-item.item-indigo:hover .menu-icon   { box-shadow: 0 0 20px rgba(99,102,241,0.5); }
.action-menu-item.item-amber:hover .menu-icon    { box-shadow: 0 0 20px rgba(245,158,11,0.5); }
.action-menu-item.item-emerald:hover .menu-icon { box-shadow: 0 0 20px rgba(16,185,129,0.5); }
.action-menu-item.item-cyan:hover .menu-icon    { box-shadow: 0 0 20px rgba(6,182,212,0.5); }
.action-menu-item.item-rose:hover .menu-icon    { box-shadow: 0 0 20px rgba(244,63,94,0.5); }
.action-menu-item.item-violet:hover .menu-icon   { box-shadow: 0 0 20px rgba(139,92,246,0.5); }
.action-menu-item .icon-blue    { background: rgba(59,130,246,0.1);  color: #3b82f6; }
.action-menu-item .icon-indigo   { background: rgba(99,102,241,0.1);  color: #6366f1; }
.action-menu-item .icon-amber    { background: rgba(245,158,11,0.1);  color: #f59e0b; }
.action-menu-item .icon-emerald { background: rgba(16,185,129,0.1);  color: #10b981; }
.action-menu-item .icon-cyan    { background: rgba(6,182,212,0.1);   color: #06b6d4; }
.action-menu-item .icon-rose    { background: rgba(244,63,94,0.1);   color: #f43f5e; }
.action-menu-item .icon-violet   { background: rgba(139,92,246,0.1);   color: #8b5cf6; }

/* 文字 */
.action-menu-item .menu-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.action-menu-item .menu-name {
    font-size: 14px;
    font-weight: 600;
    color: #f3f4f6;
    transition: color 0.3s;
}
.action-menu-item .menu-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* hover时名称变色 */
.action-menu-item.item-blue:hover .menu-name    { color: #60a5fa; }
.action-menu-item.item-indigo:hover .menu-name   { color: #818cf8; }
.action-menu-item.item-amber:hover .menu-name    { color: #fbbf24; }
.action-menu-item.item-emerald:hover .menu-name { color: #34d399; }
.action-menu-item.item-cyan:hover .menu-name    { color: #22d3ee; }
.action-menu-item.item-rose:hover .menu-name    { color: #fb7185; }
.action-menu-item.item-violet:hover .menu-name   { color: #a78bfa; }

/* 响应式：窄屏时一排一个 */
@media (max-width: 420px) {
    .action-menu-grid {
        grid-template-columns: 1fr;
    }
}

.history-panel {
    position: absolute !important;
    top: 70px !important;
    right: 24px !important;
    z-index: 90 !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
}

/* ==========================================================================
   生图结果区 - 顶级商业画廊排版 (Naked Image Gallery)
   ========================================================================== */

/* 1. 弱化聊天气泡感，保留头像 */
.message.assistant.image-result-message {
    padding: 0 !important;
    margin: 16px 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: row;
    gap: 16px;
}

.message.assistant.image-result-message .message-avatar {
    /* 恢复头像显示 */
    display: flex !important;
    flex-shrink: 0;
}

.message.assistant.image-result-message .message-body {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: calc(100% - 56px) !important; /* 减去头像和间距的宽度 */
    width: 100% !important;
    margin-left: 0 !important;
    flex: 1;
}

/* 2. 剥离卡片外壳 */
.image-result-group-card,
.video-result-group-card {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* 视频网格与图片网格一致 */
.video-result-grid {
    display: grid !important;
    gap: 4px !important;
    width: 100% !important;
}
.video-result-grid.video-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
.video-result-grid.video-grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
.video-result-grid.video-grid-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* 视频项无框 */
.video-grid-item {
    border-radius: 0 !important;
    overflow: hidden !important;
    border: none !important;
    background: transparent !important;
    position: relative;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    aspect-ratio: 3 / 2 !important;
}

/* 视频网格内占位符：与视频项相同的 3:2 */
.video-result-grid .video-loading-placeholder {
    aspect-ratio: 3 / 2 !important;
    min-height: 0 !important;
}

/* 单视频尺寸与单图一致 */
.video-result-stage {
    width: 100%;
}
.video-result-stage .video-grid-item {
    max-width: 50%;
    margin: 0;
}
@media (max-width: 768px) {
    .video-result-stage .video-grid-item {
        max-width: 100%;
    }
    .video-result-grid.video-grid-3,
    .video-result-grid.video-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* 视频悬浮操作按钮（与图片一致） */
.video-grid-item .video-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    gap: 6px;
    z-index: 10;
}
.video-grid-item:hover .video-item-actions {
    opacity: 1;
}
.video-item-actions .msg-action-btn {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: #fff !important;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}
.video-item-actions .msg-action-btn:hover {
    background: rgba(0, 0, 0, 0.8) !important;
    border-color: rgba(255,255,255,0.2) !important;
}

/* 视频加载占位符 */
.video-grid-item.video-loading-placeholder {
    min-height: 0 !important;
    aspect-ratio: 4 / 3;
    background: #0d0d0f !important;
}

/* 3. 网格布局：极细缝隙，横向最多铺满4个 */
.image-result-grid {
    display: grid !important;
    gap: 4px !important; /* 极细缝隙 */
    width: 100% !important;
}

.image-result-grid.image-grid-1 { grid-template-columns: 1fr !important; }
.image-result-grid.image-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
.image-result-grid.image-grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
.image-result-grid.image-grid-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* 单图情况的布局 */
.image-result-stage {
    width: 100%;
}
.image-result-stage .image-grid-item {
    max-width: 50%;
    margin: 0;
}
@media (max-width: 768px) {
    .image-result-stage .image-grid-item {
        max-width: 100%;
    }
}

/* 4. 图片项本身无边框铺满 */
.image-grid-item {
    border-radius: 0 !important;
    overflow: hidden !important;
    border: none !important;
    background: transparent !important;
    position: relative;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 生图加载占位符：与 chat.css 新动画统一 */
.image-loading-placeholder, .image-loading-tile {
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: linear-gradient(135deg, #18181b 0%, #0f0f12 100%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none !important;
    position: relative;
    overflow: hidden;
}

/* 网格中的图片加载占位符：固定 3:2 宽高比 */
.image-result-grid .image-loading-tile,
.image-result-grid .image-loading-placeholder {
    min-height: 0 !important;
    aspect-ratio: 3 / 2 !important;
}

/* 网格中的视频加载占位符：固定 3:2 宽高比 */
.video-result-grid .image-loading-tile,
.video-result-grid .video-loading-placeholder {
    min-height: 0 !important;
    aspect-ratio: 3 / 2 !important;
}

/* 图片加载完成后：清掉深色背景和最小高度，避免残留边框效果 */
.image-loading-placeholder.image-loaded,
.image-loading-placeholder.image-revealing,
.image-loading-tile.image-loaded,
.image-loading-tile.image-revealing {
    background: transparent !important;
    min-height: 0 !important;
}

/* 清理旧元素（进度条、Logo等已移除，保留隐藏规则作为安全网） */
.image-progress-bar,
.image-progress-text,
.placeholder-text,
.placeholder-logo {
    display: none !important;
}

.image-result-img, .result-image {
width: 100% !important;
height: auto !important;
display: block !important;
border-radius: 0 !important;
object-fit: cover !important;
}

/* 网格中的图片：撜满网格行高，避免底部黑边 */
.image-result-grid .image-grid-item .image-result-img {
height: 100% !important;
}

/* 悬浮操作分离：单图悬浮 */
.image-grid-item .image-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    gap: 6px;
    z-index: 10;
}
.image-grid-item:hover .image-item-actions {
    opacity: 1;
}

.image-item-actions .msg-action-btn {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: #fff !important;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.image-item-actions .msg-action-btn:hover {
    background: rgba(0, 0, 0, 0.8) !important;
    border-color: rgba(255,255,255,0.2) !important;
}

/* 组级别操作：放在底部，靠右 */
.image-group-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    gap: 8px;
}

.revised-prompt {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    margin-top: 8px;
    padding-left: 4px;
}

/* Revised prompts use a light-on-dark token above; restore readable contrast
   when the workspace switches to the light theme. */
body.theme-light .revised-prompt {
    color: #475569;
    background: rgba(15, 23, 42, 0.045);
    border: 1px solid rgba(100, 116, 139, 0.16);
    border-radius: 8px;
    padding: 7px 10px;
    line-height: 1.55;
}
body.chat-shell {
    background: #000;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* 星空画布 — 与首页一致，固定在全屏背景层 */
#starCanvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 0 !important;
    pointer-events: none !important;
    opacity: 0.5;
}

/* === App 容器 === */
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: transparent;
    color: var(--text-primary);
    z-index: 1;
}

.app-container::before {
    display: none;
}

/* ==========================================================================
   侧边栏 — 毛玻璃质感
   ========================================================================== */
.sidebar {
    width: 300px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

/* Logo — 整体居中，图片微调左移 */
.nav-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    text-decoration: none;
    flex: 1;
}

.logo-img {
    height: 44px;
    width: auto;
    position: relative;
    z-index: 2;
    mix-blend-mode: screen;
    margin-left: -6px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
    margin-left: -8px;
    transform: skewX(-12deg);
    /* 银色金属扫光 */
    background: linear-gradient(to right, #555 0%, #fff 45%, #fff 55%, #555 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShine 6s linear infinite;
}


.toggle-sidebar {
    font-size: 20px;
    color: var(--text-secondary);
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
}

/* === API Key 配置卡片 === */
.apikey-section {
    padding: 12px 16px 14px;
    border-bottom: 1px solid var(--border-color);
}

.key-config-card {
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.apikey-section.platform-mode .key-config-card {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.key-config-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 38px 12px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    min-width: 0;
}

.key-config-btn:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-1px);
}

.key-config-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.key-config-btn:hover .key-config-icon {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.1);
}

.key-config-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
    flex: 0 0 auto;
    white-space: nowrap;
    line-height: 1.2;
}

.key-config-btn:hover .key-config-title {
    color: var(--text-primary);
}

.key-config-status {
    font-size: 11px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    line-height: 1.4;
    display: block;
    text-align: left;
    word-break: break-word;
}

.usage-mode-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    white-space: nowrap;
    flex: 0 0 auto;
    margin-left: auto;
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-switch-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.mode-switch-btn {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mode-switch-btn:hover {
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.mode-switch-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.usage-mode-desc {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 0 2px;
}

/* === 模型分类 Tabs === */
.model-tabs {
    display: flex;
    gap: 0;
    padding: 6px;
    margin: 12px 14px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    scrollbar-width: none;
}

.model-tabs::-webkit-scrollbar {
    display: none;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
}

.tab-item:hover {
    color: rgba(255, 255, 255, 0.85);
    background: transparent;
}

.tab-item.active {
    color: #000;
    background: #fff;
    border-color: #fff;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.15);
}

/* === 模型搜索框 === */
.model-search-wrap {
    margin: 0 14px 8px;
    position: relative;
}

.model-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    transition: color 0.3s ease;
}

.model-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px 12px 8px 34px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
}

.model-search-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.model-search-input:focus + .model-search-icon,
.model-search-input:not(:placeholder-shown) + .model-search-icon {
    color: rgba(255, 255, 255, 0.8);
}

.model-search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* === 模型列表 === */
.model-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    min-height: 280px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.model-list::-webkit-scrollbar {
    width: 4px;
}

.model-list::-webkit-scrollbar-track {
    background: transparent;
}

.model-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.model-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.model-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    background: transparent;
    position: relative;
    overflow: hidden;
    margin-bottom: 4px;
}

.model-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    border-radius: 0 3px 3px 0;
    background: #ffffff;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.model-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.model-item:hover::before {
    transform: translateY(-50%) scaleY(1);
}

.model-item.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.model-item.active::before {
    transform: translateY(-50%) scaleY(1);
    background: #ffffff;
}

.model-icon-small {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    overflow: hidden;
    border: none;
    transition: all 0.25s ease;
}

.model-item:hover .model-icon-small {
    transform: scale(1.05);
}

.model-item.active .model-icon-small {
    border: none;
    box-shadow: none;
}

.model-icon-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.model-icon-img.is-openai-white,
.model-selector-icon.is-openai-white,
.model-info-icon.is-openai-white {
    filter: brightness(0) invert(1);
}

.model-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.model-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-badge {
    font-size: 9px;
    padding: 2px 7px;
    border-radius: 6px;
    flex-shrink: 0;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1.2;
    white-space: nowrap;
    text-transform: uppercase;
}

.badge-hot {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.05) 100%);
    color: #ff5a5f;
    border: 1px solid rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.1);
}

.badge-new {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.1);
}

.badge-pick {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.05) 100%);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.1);
}

.model-caps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.cap-tag {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.model-item:hover .cap-tag {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

/* === 侧边栏底部 === */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.02) 100%);
}

/* === 对话历史区 (已废弃，隐藏) === */
.conv-section {
    display: none !important;
}

.conv-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 8px;
}

.conv-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.conv-new-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
}

.conv-new-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.conv-list::-webkit-scrollbar {
    width: 4px;
}

.conv-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.conv-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.conv-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.conv-item.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.conv-item-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.conv-item-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   主内容区
   ========================================================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.main-content::before {
    display: none;
}

/* === 顶部工具栏 === */
.toolbar {
    padding: 16px 28px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
}

.toolbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0.5;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.toolbar-home-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toolbar-home-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.toolbar-home-mark {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    /* 银色金属扫光 */
    background: linear-gradient(to right, #666 0%, #fff 45%, #fff 55%, #666 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShine 6s linear infinite;
}

.toolbar-home-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.toolbar-model-wrap {
    min-width: 0;
}

.toolbar-kicker {
    display: inline-block;
    margin-bottom: 4px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.model-selector-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.current-model-name {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.5px;
    /* 银色金属质感 */
    background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.current-model-type {
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.toolbar-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.toolbar-btn:active {
    transform: scale(0.96);
}

.mobile-menu-btn {
    display: none;
}

/* ==========================================================================
   内容区域 / 消息列表
   ========================================================================== */
.content-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
    padding: 0 24px;
    scrollbar-width: none;
}

.content-area::-webkit-scrollbar {
    width: 0;
    display: none;
}

.content-area.fade-out {
    opacity: 0;
    transition: opacity 0.12s ease;
}

.content-area.fade-in {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* === 欢迎屏 — 与首页 Hero 风格统一 === */
.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 36px 0 0;
}

.welcome-content {
    text-align: center;
    max-width: 880px;
    width: min(100%, 880px);
    padding: 48px;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 28%),
        linear-gradient(180deg, rgba(20, 20, 24, 0.4) 0%, rgba(10, 10, 12, 0.6) 100%);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(26px);
    -webkit-backdrop-filter: blur(26px);
    animation: welcomeFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes welcomeFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 银色金属扫光动画 — 与首页 textShine 完全一致 */
@keyframes textShine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.welcome-eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    margin-bottom: 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.welcome-logo-img {
    width: 168px;
    height: auto;
    margin-bottom: 18px;
    filter: none;
    mix-blend-mode: screen;
}

/* 欢迎屏大标题「繁星AI」— 与首页 hero 一致的扫光效果 */
.welcome-brand-title {
    font-size: clamp(48px, 7vw, 80px);
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #555 0%, #fff 40%, #fff 60%, #555 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShine 5s linear infinite;
}

.welcome-content h2 {
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.2;
}

.welcome-desc {
    max-width: 640px;
    margin: 0 auto 28px !important;
    font-size: 15px !important;
    color: var(--text-secondary) !important;
    line-height: 1.8;
}

.welcome-prompt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.welcome-prompt-card {
    padding: 18px 18px 16px;
    text-align: left;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    appearance: none;
    width: 100%;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.welcome-prompt-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
}

.welcome-prompt-card:focus-visible {
    outline: none;
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.welcome-prompt-label {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.welcome-prompt-card strong {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    font-weight: 600;
}

.welcome-meta {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.welcome-meta-chip {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.welcome-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    padding: 18px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.feature-icon {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

.welcome-feature-item h4 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.welcome-feature-item p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* === 消息容器 === */
.messages-container {
    padding: 24px 0 56px;
    display: flex;
    flex-direction: column;
    max-width: 936px;
    margin: 0 auto;
    width: 100%;
}

.scroll-bottom-btn {
    position: fixed;
    right: 28px;
    bottom: 220px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 10, 12, 0.72);
    color: #fff;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 80;
}

.scroll-bottom-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-bottom-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.scroll-bottom-btn span {
    font-size: 12px;
    font-weight: 600;
}

/* === 消息气泡 === */
.message {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    transition: background-color 0.15s;
    animation: msgFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.message.user .message-body {
    align-items: flex-end;
}

.message.editing .message-body {
    opacity: 0.5;
}

.message.editing .message-content {
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, 0.2);
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(200, 200, 200, 0.9) 100%);
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(200, 200, 200, 0.9) 100%);
    color: #000000;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.message.assistant .message-avatar {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.msg-avatar-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* 根据特定模型判断是否需要反色为白色 */
.msg-avatar-img.is-openai-white {
    filter: brightness(0) invert(1);
}

.message-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--border-color);
}

.message-img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    max-width: min(100%, 320px);
}

.message-file-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.message-file-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

@media (max-width: 640px) {
    .message-file-name {
        max-width: min(58vw, 190px);
    }
}

.message-content {
    padding: 4px 0;
    line-height: 1.7;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--text-primary);
}

/* 用户消息气泡 */
.message.user .message-content {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 4px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* AI 消息不加气泡背景，保持干净 */
.message.assistant .message-content {
    padding: 4px 0;
    background: transparent;
    border: none;
}

/* === 思考动画 === */
.thinking-dots {
    display: inline-flex;
    gap: 4px;
    padding: 8px 0;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: thinkingBounce 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingBounce {
    0%, 60%, 100% { transform: scale(0.8); opacity: 0.4; }
    30% { transform: scale(1.2); opacity: 1; }
}

/* === 深度思考 - 极简线条风 === */
.thinking-section {
    margin: 8px 0 16px;
    border-left: 2px solid rgba(0, 216, 255, 0.3);
    background: transparent;
    overflow: hidden;
}

.thinking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thinking-header:hover {
    background: rgba(0, 216, 255, 0.03);
}

.thinking-header-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.thinking-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    color: #00D8FF;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.thinking-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.thinking-level {
    color: rgba(0, 216, 255, 0.72);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
}

.thinking-level:empty {
    display: none;
}

.thinking-section.no-content .thinking-header {
    cursor: default;
}

.thinking-section.no-content .thinking-toggle,
.thinking-section.no-content .thinking-content {
    display: none;
}

.thinking-status {
    min-width: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thinking-toggle {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.thinking-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
}

.thinking-toggle svg {
    transition: transform 0.3s ease;
}

.thinking-section.expanded .thinking-toggle svg {
    transform: rotate(180deg);
}

.thinking-content {
    display: none;
    padding: 0 0 12px 14px;
}

.thinking-section.expanded .thinking-content {
    display: block;
}

.thinking-content-inner {
    padding: 12px 14px;
    border-radius: 0 8px 8px 0;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    line-height: 1.75;
    border-left: 1px solid rgba(0, 216, 255, 0.1);
}

.thinking-content-inner p {
    margin: 0 0 10px;
}

.thinking-content-inner p:last-child {
    margin-bottom: 0;
}

/* 思考中状态 */
.thinking-section.is-streaming .thinking-chip svg {
    animation: thinking-pulse 1.5s ease-in-out infinite;
}

@keyframes thinking-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.thinking-section.is-streaming .thinking-status::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 6px;
    border-radius: 50%;
    background: #00D8FF;
    vertical-align: middle;
    animation: thinking-dot 1.4s ease-in-out infinite;
}

@keyframes thinking-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.thinking-section.is-complete .thinking-status::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 6px;
    border-radius: 50%;
    background: rgba(0, 216, 255, 0.6);
    vertical-align: middle;
}

/* === 消息操作按钮 === */
.message-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.msg-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.msg-action-btn.danger:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   输入区域 — 毛玻璃质感
   ========================================================================== */
.input-area {
    padding: 0 24px 28px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.4) 20%, rgba(0, 0, 0, 0.85) 100%);
    position: relative;
    z-index: 10;
    transition: padding 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-container {
    max-width: 980px;
    margin: 0 auto;
    position: relative;
}

/* 上下文截断提示：告诉用户早期消息已不发给 AI */
.context-truncation-hint {
    max-width: 920px;
    margin: 0 auto 8px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(245, 158, 11, 0.9);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: contextHintFadeIn 0.3s ease-out;
}

.context-truncation-hint svg {
    flex-shrink: 0;
    opacity: 0.9;
}

@keyframes contextHintFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .context-truncation-hint {
        margin: 0 12px 8px;
        font-size: 11px;
        padding: 7px 12px;
    }
}

.input-area.composer-collapsed {
    padding-bottom: 16px;
}

/* 输入框内参考图区 */
.reference-stage {
    position: absolute;
    top: 18px;
    left: 22px;
    width: 190px;
    height: 118px;
    z-index: 6;
    display: none;
    pointer-events: none;
    overflow: visible;
    contain: layout;
    backface-visibility: hidden;
    will-change: transform, opacity;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.reference-stage > * {
    pointer-events: auto;
}

.chat-input-box.has-reference-stage textarea {
    padding-left: 146px;
    min-height: 112px;
    /* height 由 JS autoResizeTextarea 每键接管，不应走 CSS transition（否则导致 Vidu 输入卡顿） */
    transition: min-height 0.36s cubic-bezier(0.16, 1, 0.3, 1), padding 0.36s cubic-bezier(0.16, 1, 0.3, 1), font-size 0.3s ease, line-height 0.3s ease;
}
.chat-input-box.has-reference-stage .rich-input {
    padding-left: 146px;
    min-height: 112px;
    /* height 由 JS autoResizeTextarea 每键接管，不应走 CSS transition（否则导致 Vidu 输入卡顿） */
    transition: min-height 0.36s cubic-bezier(0.16, 1, 0.3, 1), padding 0.36s cubic-bezier(0.16, 1, 0.3, 1), font-size 0.3s ease, line-height 0.3s ease;
}

.chat-input-box.has-reference-stage .input-hint {
    padding-left: 146px;
}

.empty-reference-trigger {
    position: absolute;
    top: 14px;
    left: 44px;
    width: 68px;
    height: 88px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
        rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    /* 显式覆盖 chat.css:4532 的 backdrop-filter，避免 Vidu 滚动时双层 backdrop 重新栅格化导致卡顿 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* 保留完整 transition（含 top/left/width/height）让动画平滑，JS 层的 400ms 防抖已经解决死锁问题 */
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), top 0.35s cubic-bezier(0.16, 1, 0.3, 1), left 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.reference-stage.has-images .empty-reference-trigger {
    width: 24px;
    height: 24px;
    left: 92px;
    top: 96px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(30, 33, 40, 0.95);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    transform: none;
    opacity: 1;
    z-index: 40;
    transition: all 0.25s ease;
}

/* 当鼠标 hover 到图片区域展开时，隐藏独立的小加号 */
.reference-stage.is-expanded .empty-reference-trigger {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

.empty-reference-trigger:hover {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)),
        rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.34);
    transform: translate(20px, -4px) rotate(-5deg) scale(1.02);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

.reference-stage.has-images .empty-reference-trigger:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(58, 63, 74, 0.98);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.4);
}

/* --- 新增：专门用于展开时的追加占位卡片 --- */
.preview-area .preview-item-add {
    opacity: 0;
    pointer-events: none;
    width: 68px;
    height: 88px;
    border-radius: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    --card-x: 0px;
    --card-y: 10px;
    --card-rotate: 0deg;
}

.reference-stage.is-expanded .preview-item-add {
    opacity: 1;
    pointer-events: auto;
    --card-x: calc(var(--real-index) * 64px + 14px);
    --card-y: 8px;
}

.preview-area .preview-item-add:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translate(var(--card-x), calc(var(--card-y) - 2px)) scale(1.02) !important;
}

.preview-item-add .empty-reference-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.42);
}

.preview-item-add .empty-reference-content span {
    font-size: 12px;
}

.preview-item-add .empty-reference-icon {
    width: 14px;
    height: 14px;
}

.preview-item-add .empty-reference-icon svg {
    width: 100%;
    height: 100%;
}

.reference-stage:not(.has-images) .empty-reference-trigger {
    left: 20px;
    transform: translate(0, 0) rotate(-6deg);
    opacity: 1;
}

.reference-stage:not(.has-images) .empty-reference-trigger:hover {
    transform: translate(0, -6px) rotate(-3deg) scale(1.03);
}

.reference-stage.has-images .empty-reference-trigger .empty-reference-content {
    gap: 0;
}

.reference-stage.has-images .empty-reference-trigger .empty-reference-content span {
    display: none;
}

.reference-stage.has-images .empty-reference-icon {
    width: 14px;
    height: 14px;
}

.reference-stage.has-images .empty-reference-icon svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.reference-stage.has-images .empty-reference-badge {
    display: none;
}

.empty-reference-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.42);
    transition: color 0.25s ease;
}

.empty-reference-trigger:hover .empty-reference-content {
    color: rgba(255, 255, 255, 0.82);
}

.empty-reference-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-reference-content span {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.empty-reference-badge {
    position: absolute;
    bottom: 8px;
    left: -10px;
    width: 24px;
    height: 24px;
    background: rgba(20, 184, 166, 0.16);
    border: 1px solid rgba(20, 184, 166, 0.46);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #18d0c0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.28s ease, background 0.28s ease;
    box-shadow: 0 10px 16px rgba(3, 10, 18, 0.28);
}

.empty-reference-trigger:hover .empty-reference-badge {
    transform: scale(1.08) translateY(-1px);
    background: rgba(20, 184, 166, 0.24);
    box-shadow: 0 0 16px rgba(20, 184, 166, 0.18);
}

.preview-area {
    position: absolute;
    inset: 0;
    display: none;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    overflow: visible;
    pointer-events: none;
}

.reference-stage.is-expanded .preview-area {
    width: calc(var(--total-imgs) * 64px + 180px);
    padding-right: 92px;
}

.preview-area:empty {
    display: none;
}

.preview-item {
    --card-x: 0px;
    --card-y: 0px;
    --card-rotate: -8deg;
    --card-hover-rotate: 0deg;
    position: absolute;
    top: 10px;
    left: 12px;
    width: 70px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        rgba(14, 16, 22, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 10px;
    color: #ffffff;
    cursor: pointer;
    
    transform: translate(var(--card-x), var(--card-y)) rotate(var(--card-rotate));
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease, filter 0.25s ease, opacity 0.35s ease;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.22);
    overflow: visible;
    pointer-events: auto;
}

.preview-item.is-stack-hidden {
    opacity: 0;
    pointer-events: none;
}

/* 堆叠状态坐标 (stack-index: 0=倒数第三张, 1=倒数第二张, 2=最新一张) */
.preview-item[style*="--stack-index: 0"] {
    --card-x: 4px;
    --card-y: 14px;
    --card-rotate: -12deg;
}

.preview-item[style*="--stack-index: 1"] {
    --card-x: 36px;
    --card-y: 4px;
    --card-rotate: 8deg;
}

.preview-item[style*="--stack-index: 2"] {
    --card-x: 68px;
    --card-y: 12px;
    --card-rotate: -6deg;
}

/* 隐藏堆叠下的更早图片 */
.preview-item[style*="--stack-index: -"] {
    --card-x: 0px;
    --card-y: 10px;
    --card-rotate: 0deg;
}

/* 展开状态：更松的扇形展开 */
.reference-stage.is-expanded .preview-item {
    opacity: 1;
    pointer-events: auto;
    --card-x: calc(var(--real-index) * 64px);
    --card-y: calc(8px - min(var(--real-index), 6) * 2px);
    --card-rotate: calc(-12deg + min(var(--real-index), 6) * 4deg);
}

.reference-stage.is-expanded .more-imgs-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.preview-item:hover {
    border-color: rgba(255, 255, 255, 0.44);
    transform: translate(var(--card-x), calc(var(--card-y) - 14px)) scale(1.04) !important;
    box-shadow: 0 24px 34px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.08);
    filter: saturate(1.05);
    z-index: 100 !important;
}

.preview-item img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

.more-imgs-overlay {
    position: absolute;
    inset: 4px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    z-index: 10;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.preview-item .preview-name {
    display: none;
}

.preview-floating-name {
    position: absolute;
    top: -34px;
    left: -52px;
    max-width: 180px;
    padding: 7px 14px;
    border-radius: 12px;
    background: rgba(80, 88, 102, 0.42);
    color: rgba(235, 238, 244, 0.82);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(10px) rotate(4deg);
    pointer-events: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.preview-item:hover .preview-floating-name {
    opacity: 1;
    transform: translateY(0) rotate(4deg);
}

.preview-item .img-ref {
    position: absolute;
    top: 5px;
    right: 5px;
    left: auto;
    bottom: auto;
    background: rgba(10, 12, 16, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.92);
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    white-space: nowrap;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.28);
}

.preview-item .img-ref:hover {
    background: rgba(99, 102, 241, 0.86);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(0, 0, 0, 0.3);
}

.preview-item-file {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
        rgba(22, 24, 30, 0.92);
}

.preview-item .file-icon {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: #f4e8c4;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.preview-remove {
    position: absolute;
    top: -10px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(37, 40, 48, 0.94);
    color: #f6f7fb;
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.22s ease, transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
}

.preview-item:hover .preview-remove {
    opacity: 1;
    transform: scale(1);
}

.preview-remove:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

/* === 输入框主体 === */
.chat-input-box {
    background: linear-gradient(180deg, rgba(20, 22, 27, 0.82), rgba(15, 17, 21, 0.78));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow:
        0 18px 44px rgba(0, 0, 0, 0.34),
        0 1px 0 rgba(255, 255, 255, 0.03) inset;
    overflow: visible; /* 改为 visible 允许价格标签浮出 */
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    contain: layout style; /* 隔离布局计算，减少 transition 过程中的 reflow 影响范围 */
    position: relative;
    max-width: 936px;
    margin: 0 auto;
    z-index: 20;
}

.chat-input-box.composer-collapsed {
    max-width: 772px;
    min-height: 72px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(18, 20, 25, 0.86), rgba(15, 17, 21, 0.8));
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 18px 34px rgba(0, 0, 0, 0.24),
        0 0 0 1px rgba(255, 255, 255, 0.018);
    transform: translateY(-6px);
    will-change: transform, border-radius, box-shadow;
}

.img-ref-autocomplete {
    position: absolute;
    padding: 6px;
    background: rgba(24, 27, 33, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    max-height: min(320px, 42vh);
    overflow: hidden;
    z-index: 10000;
}

.img-ref-menu-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 8px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.img-ref-menu-title {
    color: rgba(248, 250, 252, 0.94);
    font-size: 13px;
    font-weight: 650;
}

.img-ref-menu-desc {
    color: rgba(203, 213, 225, 0.48);
    font-size: 11px;
    white-space: nowrap;
}

.img-ref-menu-list {
    max-height: min(258px, 34vh);
    padding-top: 5px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.24) transparent;
}

.img-ref-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    color: inherit;
    background: transparent;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.img-ref-item:hover,
.img-ref-item.is-active {
    background: rgba(255, 255, 255, 0.075);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

.img-ref-item img {
    width: 40px;
    height: 40px;
    border-radius: 7px;
    object-fit: cover;
    flex: 0 0 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.img-ref-title {
    color: rgba(248, 250, 252, 0.92);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.img-ref-item .img-ref-name {
    max-width: 100%;
    overflow: hidden;
    color: rgba(203, 213, 225, 0.52);
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.img-ref-item .img-ref-tag {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid rgba(129, 140, 248, 0.2);
    border-radius: 6px;
    color: rgba(199, 210, 254, 0.86);
    background: rgba(99, 102, 241, 0.12);
    font-size: 11px;
    font-weight: 600;
}

.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.drag-overlay.active {
    display: flex;
}

.drag-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.chat-input-box.dragging {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06), 0 30px 80px rgba(0, 0, 0, 0.32);
}

.chat-input-box.is-generating {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 26px 72px rgba(0, 0, 0, 0.34);
}


.chat-input-box:focus-within {
    border-color: rgba(186, 214, 255, 0.18);
    box-shadow:
        0 0 0 1px rgba(194, 217, 255, 0.05),
        0 0 0 4px rgba(122, 162, 255, 0.04),
        0 28px 72px rgba(0, 0, 0, 0.36);
}

.chat-input-box textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    padding: 24px 26px 0;
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    max-height: 200px;
    outline: none;
    backface-visibility: hidden;
    will-change: padding, font-size, height, min-height;
    transition: height 0.36s cubic-bezier(0.16, 1, 0.3, 1), min-height 0.36s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.36s cubic-bezier(0.16, 1, 0.3, 1), padding 0.36s cubic-bezier(0.16, 1, 0.3, 1), font-size 0.3s ease, line-height 0.3s ease;
}

.chat-input-box.composer-collapsed textarea {
    min-height: 0;
    height: 72px !important;
    max-height: 72px;
    padding: 24px 84px 18px 24px;
    font-size: 14px;
    line-height: 1.35;
}

.chat-input-box textarea:focus {
    outline: none;
}

.chat-input-box textarea::placeholder {
    color: var(--text-muted);
}

/* === 富文本输入框（contenteditable div 替代 textarea）=== */
.chat-input-box .rich-input {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    padding: 24px 26px 0;
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    max-height: 200px;
    min-height: 1.6em;
    outline: none;
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
    backface-visibility: hidden;
    will-change: padding, font-size, min-height;
    /* height 由 JS autoResizeTextarea 每键接管，不应走 CSS transition（否则导致 Vidu 输入卡顿） */
    transition: min-height 0.36s cubic-bezier(0.16, 1, 0.3, 1), padding 0.36s cubic-bezier(0.16, 1, 0.3, 1), font-size 0.3s ease, line-height 0.3s ease;
    caret-color: var(--text-primary);
}

/* placeholder */
.chat-input-box .rich-input.is-empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.chat-input-box.composer-collapsed .rich-input {
    min-height: 0;
    height: 72px !important;
    max-height: 72px;
    padding: 24px 84px 18px 24px;
    font-size: 14px;
    line-height: 1.35;
}

.chat-input-box .rich-input:focus {
    outline: none;
}

.chat-input-box.has-reference-stage .rich-input {
    padding-top: 12px;
}

/* === 图片缩略图芯片 === */
.img-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 3px 9px 3px 3px;
    margin: 1px 3px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 7px;
    background: rgba(51, 56, 67, 0.78);
    vertical-align: middle;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.16s ease, border-color 0.16s ease;
    line-height: 1.2;
}

.img-chip:hover {
    background: rgba(61, 67, 80, 0.9);
    border-color: rgba(165, 180, 252, 0.28);
}

/* 暗色模式 */
.dark-theme .img-chip,
[data-theme="dark"] .img-chip {
    background: rgba(51, 56, 67, 0.78);
}
.dark-theme .img-chip:hover,
[data-theme="dark"] .img-chip:hover {
    background: rgba(61, 67, 80, 0.9);
}

.img-chip-thumb {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-quaternary, rgba(0,0,0,0.04));
    flex-shrink: 0;
}

.img-chip-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(241, 245, 249, 0.88);
}

/* ── 音频芯片（@audioN）── */
.audio-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 3px 9px 3px 5px;
    margin: 1px 3px;
    border-radius: 7px;
    background: rgba(51, 56, 67, 0.78);
    border: 1px solid rgba(45, 212, 191, 0.2);
    vertical-align: middle;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.2s ease;
    line-height: 1.2;
}
.audio-chip:hover {
    background: rgba(20, 184, 166, 0.2);
}
.audio-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: rgba(20, 184, 166, 0.2);
    color: #14b8a6;
    flex-shrink: 0;
}
.audio-chip-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(204, 251, 241, 0.84);
}
/* 暗色模式 */
.dark-theme .audio-chip,
[data-theme="dark"] .audio-chip,
body:not(.theme-light) .audio-chip {
    background: rgba(20, 184, 166, 0.15);
    border-color: rgba(20, 184, 166, 0.3);
}
body:not(.theme-light) .audio-chip:hover {
    background: rgba(20, 184, 166, 0.25);
}
body:not(.theme-light) .audio-chip-label,
body:not(.theme-light) .audio-chip-icon {
    color: #2dd4bf;
}
/* 浅色模式 */
body.theme-light .audio-chip {
    background: rgba(20, 184, 166, 0.08);
    border-color: rgba(20, 184, 166, 0.2);
}
body.theme-light .audio-chip-label {
    color: #0d9488;
}
body.theme-light .audio-chip-icon {
    color: #0d9488;
    background: rgba(20, 184, 166, 0.1);
}
/* 自动补全里的音频图标 */
.audio-ref-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(20, 184, 166, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #14b8a6;
    flex-shrink: 0;
}

.input-hint {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 26px 8px;
    opacity: 0.52;
    transition: opacity 0.22s ease, padding 0.32s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-input-box.composer-collapsed .input-hint {
    opacity: 0;
    max-height: 0;
    padding: 0 24px;
    overflow: hidden;
}

.chat-input-box:focus-within .input-hint {
    opacity: 1;
}

/* === 输入工具栏 === */
.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px 16px 18px;
    gap: 14px;
    border-top: none;
    will-change: transform, opacity;
    transition: margin-top 0.36s cubic-bezier(0.16, 1, 0.3, 1), height 0.36s cubic-bezier(0.16, 1, 0.3, 1), padding 0.36s cubic-bezier(0.16, 1, 0.3, 1), gap 0.36s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease, border-color 0.36s ease;
}

.chat-input-box.composer-collapsed .input-toolbar {
    margin-top: -72px;
    height: 72px;
    padding: 0 10px 0 0;
    justify-content: flex-end;
    border-top-color: transparent;
    pointer-events: none;
    gap: 0;
}

.chat-input-box.composer-collapsed .input-toolbar-left {
    opacity: 0;
    width: 0;
    min-width: 0;
    max-width: 0;
    overflow: hidden;
    pointer-events: none;
    gap: 0;
    transform: translateX(-8px);
}

.chat-input-box.composer-collapsed .input-toolbar-right {
    gap: 0;
    transform: scale(0.96);
    pointer-events: auto;
}

.chat-input-box.composer-collapsed .send-btn,
.chat-input-box.composer-collapsed .stop-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
}

.chat-input-box.composer-collapsed.has-reference-stage textarea {
    padding-left: 100px;
    min-height: 0;
}
.chat-input-box.composer-collapsed.has-reference-stage .rich-input {
    padding-left: 100px;
    min-height: 0;
}

.chat-input-box.composer-collapsed.has-reference-stage .reference-stage {
    top: 50%;
    left: 16px;
    width: 64px;
    height: 64px;
    opacity: 0.96;
    transform: translateY(-50%) scale(0.92);
}

.chat-input-box.composer-collapsed .reference-stage:not(.has-images) .empty-reference-trigger {
    top: 10px;
    left: 8px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    transform: rotate(-7deg);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

.chat-input-box.composer-collapsed .reference-stage:not(.has-images) .empty-reference-content {
    gap: 0;
}

.chat-input-box.composer-collapsed .reference-stage:not(.has-images) .empty-reference-content span,
.chat-input-box.composer-collapsed .reference-stage:not(.has-images) .empty-reference-badge {
    display: none;
}

.chat-input-box.composer-collapsed .reference-stage:not(.has-images) .empty-reference-icon {
    width: 16px;
    height: 16px;
}

.chat-input-box.composer-collapsed .reference-stage.has-images {
    top: 50%;
    left: 12px;
    width: 76px;
    height: 52px;
    opacity: 0.96;
    transform: translateY(-50%) scale(0.94);
}

.chat-input-box.composer-collapsed .reference-stage.has-images .preview-area {
    transform: scale(0.72);
    transform-origin: left center;
}

.chat-input-box.composer-collapsed .reference-stage.has-images .empty-reference-trigger {
    left: 54px;
    top: 30px;
    width: 20px;
    height: 20px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.chat-input-box.composer-collapsed .chat-price-badge {
    opacity: 0;
    pointer-events: none;
}


.input-toolbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
    max-width: 1000px;
    transition: opacity 0.22s ease, max-width 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), gap 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: gap 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.toggle-tool {
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
}

.toggle-tool:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.toggle-tool.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.14);
}

.toggle-tool.active.web-search {
    background-color: rgba(52, 211, 153, 0.1);
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.2);
}

.toggle-tool.active.thinking-mode {
    background: linear-gradient(180deg, rgba(212, 178, 106, 0.12), rgba(212, 178, 106, 0.05));
    color: #f4dfb7;
    border-color: rgba(212, 178, 106, 0.22);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(180deg, #eef3ff, #cfdcff);
    color: #10141d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow:
        0 10px 24px rgba(96, 132, 255, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #f8fbff, #d9e5ff);
    transform: translateY(-1px);
    box-shadow:
        0 14px 28px rgba(96, 132, 255, 0.24),
        0 1px 0 rgba(255, 255, 255, 0.74) inset;
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.34);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.stop-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background-color: var(--danger);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.stop-btn:hover {
    background-color: #b91c1c;
}

/* === 路由策略按钮 === */
.route-trigger-btn {
    gap: 6px;
    padding: 6px 10px 6px 8px;
    min-width: 0;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.route-trigger-btn:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.route-trigger-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);

/* === 生图结果组卡片 === */
.image-result-message .message-body {
    width: 100%;
    max-width: 100%;
}

.image-result-message.message.assistant .message-body {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.image-result-group-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.image-result-group-card.is-grid {
    width: 100%;
    margin: 0;
}

.image-result-group-card.is-single {
    width: min(760px, 100%);
    margin: 0 auto;
}

.image-result-stage {
    width: min(760px, 100%);
}

.image-result-group-card .image-result-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.image-result-group-card .image-result-grid.image-grid-2 > .image-grid-item {
    flex: 1 1 calc(50% - 2px);
    max-width: calc(50% - 1px);
}

.image-result-group-card .image-result-grid.image-grid-3 > .image-grid-item {
    flex: 1 1 calc(33.33% - 2px);
    max-width: calc(33.33% - 1.33px);
}

.image-result-message .image-result-group-card .image-result-grid.image-grid-4 > .image-grid-item {
    flex: 1 1 calc(25% - 2px);
    max-width: calc(25% - 1.5px);
}

.image-result-group-card .image-grid-item {
    position: relative;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.image-result-group-card .image-loading-placeholder {
min-height: 160px;
border-radius: 0;
}

/* 网格内图片占位符：固定 3:2 宽高比 */
.image-result-group-card .image-result-grid .image-loading-placeholder,
.image-result-group-card .image-result-grid .image-loading-tile {
    min-height: 0 !important;
    aspect-ratio: 3 / 2 !important;
}

/* 网格内视频占位符：固定 3:2 宽高比 */
.image-result-group-card .video-result-grid .video-loading-placeholder {
    min-height: 0 !important;
    aspect-ratio: 3 / 2 !important;
}

.image-result-stage .image-grid-item {
    border-radius: 0;
}

.image-result-stage .image-loading-placeholder {
    min-height: 420px;
    border-radius: 0;
}

.image-result-group-card .image-grid-item .image-result-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: auto;
    display: block;
}

.image-result-stage .image-grid-item .image-result-img {
    aspect-ratio: auto;
    object-fit: contain;
    max-height: 760px;
}

.image-item-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 3;
}

.image-grid-item:hover .image-item-actions,
.image-grid-item:focus-within .image-item-actions {
    opacity: 1;
    transform: translateY(0);
}

.image-item-action {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    justify-content: center;
    color: rgba(241, 245, 249, 0.88);
    background: rgba(9, 12, 18, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.image-item-action:hover {
    background: rgba(18, 22, 30, 0.92);
    border-color: rgba(255, 255, 255, 0.18);
}

.image-item-action svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.image-result-loading-card {
    padding: 12px;
}

.image-result-loading-card .image-grid-item {
    border-color: rgba(255, 255, 255, 0.05);
}

.image-result-group-card .revised-prompt,
.revised-prompt {
    margin-top: 2px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(203, 213, 225, 0.86);
}

@media (max-width: 768px) {
    .image-result-message .message-body {
        max-width: 100%;
    }

    .image-result-group-card {
        padding: 12px;
        border-radius: 18px;
        gap: 12px;
    }

    .image-result-group-card.is-grid {
        width: 100%;
    }

    .image-result-group-card .image-result-grid.image-grid-3,
    .image-result-group-card .image-result-grid.image-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .image-result-group-card .image-loading-placeholder {
        min-height: 160px;
    }

    .image-result-stage .image-loading-placeholder {
        min-height: 280px;
    }
}

@media (max-width: 520px) {
    .image-result-group-card .image-result-grid.image-grid-2,
    .image-result-group-card .image-result-grid.image-grid-3,
    .image-result-group-card .image-result-grid.image-grid-4 {
        grid-template-columns: minmax(0, 1fr);
    }
}
    color: var(--text-primary);
}

.route-trigger-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.78);
}

.route-trigger-icon.icon-purple { color: #d946ef; }
.route-trigger-icon.icon-yellow { color: #eab308; }
.route-trigger-icon.icon-blue { color: #3b82f6; }
.route-trigger-icon.icon-green { color: #22c55e; }
.route-trigger-icon.is-channel { color: rgba(255, 255, 255, 0.78); }

.route-trigger-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.route-trigger-price {
    font-size: 10px;
    color: var(--text-secondary);
}

/* === 路由策略选择组 === */
.route-switch-btn.active {
    color: #000000;
    border-color: transparent;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   模态框 / 弹窗 — 统一毛玻璃
   ========================================================================== */
.modal-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.settings-modal-content {
    max-width: 620px;
    border-radius: 28px;
}

.modal-header h3 {
    color: var(--text-primary);
}

.settings-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-header-text h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
}

.settings-header-text p {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.close-modal {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    transition: all 0.3s;
}

.close-modal:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    color: var(--text-primary);
}

.settings-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-group {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.settings-group-head {
    margin-bottom: 14px;
}

.settings-group-kicker {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.settings-group-head h4 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.settings-group-head p {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.setting-item label {
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-group .setting-item:first-of-type {
    padding-top: 0;
    border-top: none;
}

.setting-hint {
    color: var(--text-muted);
}

.setting-input,
.setting-range {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 12px 16px;
    transition: all 0.3s;
}

.setting-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
}

.usage-mode-manage-btn {
    margin-top: 10px;
    align-self: flex-start;
    border-radius: 10px;
}

.settings-footnote {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 2px 2px 0;
}

/* 确认弹窗 */
.confirm-modal-content {
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.confirm-header h3 {
    color: var(--text-primary);
}

.confirm-body p {
    color: var(--text-secondary);
}

.confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 20px;
    transition: all 0.3s;
}

.confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.confirm-btn-ok {
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.2);
}

.confirm-btn-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
}

.confirm-modal.danger .confirm-btn-ok {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

/* === Key 管理弹窗 === */
.key-manager-modal,
.key-add-modal {
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
}

.modal-header-icon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.modal-header-text h3 {
    color: var(--text-primary);
}

.modal-header-text p {
    color: var(--text-secondary);
}

.key-status-bar {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.key-status-label {
    color: var(--text-muted);
}

.key-status-value {
    color: var(--text-primary);
}

.form-label {
    color: var(--text-primary);
}

.form-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 14px 16px;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
}

.form-hint {
    color: var(--text-muted);
}

.btn-primary {
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* === 公告面板 === */
.notice-panel {
    background: rgba(18, 18, 20, 0.9);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
}

.notice-panel-header h3 {
    color: var(--text-primary);
}

.notice-panel-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.notice-panel-title {
    color: var(--text-primary);
}

.notice-panel-content {
    color: var(--text-secondary);
}

.notice-panel-date {
    color: var(--text-muted);
}

.notice-panel-badge {
    font-weight: 500;
}

.notice-panel-badge.new {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.notice-panel-badge.update {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.notice-panel-badge.urgent {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.notice-panel-badge.notice {
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* === 联系客服弹窗 === */
.contact-modal-content {
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.contact-modal-body {
    color: var(--text-primary);
}

/* === Toast 提示 === */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: rgba(18, 18, 20, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.3);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast.info {
    border-color: rgba(255, 255, 255, 0.15);
}

/* === 灯箱 === */
.image-lightbox,
.video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
}

.lightbox-overlay {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lightbox-close,
.lightbox-download {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    transition: all 0.3s;
}

.lightbox-close:hover,
.lightbox-download:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* === 代码块 === */
.code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 12px 0;
}

.code-block pre {
    overflow-x: auto !important;
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
}

.code-block code {
    color: rgba(255, 255, 255, 0.9);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* === Frame Upload Panel === */
.frame-upload-panel {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.frame-slot {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.frame-slot:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.frame-slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 10px;
}

.frame-slot-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius-sm) - 1px);
}

.frame-slot-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.9);
}

.frame-slot-arrow {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.frame-slot-label {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
}

/* === 历史面板 === */
.history-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    background: rgba(18, 18, 20, 0.9);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    z-index: 200;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    font-weight: 600;
}

.history-panel-close {
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s;
}

.history-panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.history-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* === TTS 播放器 === */
.tts-player {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
}

.tts-player-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(18, 18, 20, 0.9);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.tts-info {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.tts-close {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.tts-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

/* === 图片选项弹窗 === */
.image-options-popup,
.route-strategy-popup {
    background: rgba(18, 18, 20, 0.9);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
}

/* === 选中文字 === */
::selection {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* === 滚动条全局 === */
::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    background: transparent;
}

html {
    scrollbar-width: none;
}

body {
    -ms-overflow-style: none;
}

/* ==========================================================================
   响应式 — 移动端
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 150;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .message-content {
        max-width: 90%;
    }

    .message-body {
        max-width: 90%;
    }

    .input-area {
        padding: 0 12px 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .messages-container {
        padding: 16px 0 44px;
    }

    .message {
        padding: 10px 12px;
    }

    .message-actions {
        opacity: 1;
    }

    .input-toolbar {
        flex-wrap: wrap;
        padding: 12px 14px 14px;
    }

    .reference-stage {
        top: 14px;
        left: 16px;
        width: 144px;
        height: 98px;
    }

    .empty-reference-trigger {
        width: 58px;
        height: 78px;
        left: 34px;
    }

    .chat-input-box.has-reference-stage textarea {
        padding-left: 168px;
        min-height: 98px;
    }
    .chat-input-box.has-reference-stage .rich-input {
        padding-left: 168px;
        min-height: 98px;
    }

    .reference-stage.has-images .empty-reference-trigger {
        top: 64px;
        left: 108px;
        width: 30px;
        height: 30px;
    }

    .input-toolbar-left {
        flex-wrap: wrap;
        gap: 6px;
    }

    .route-strategy-popup {
        width: min(320px, calc(100vw - 24px));
    }

    .input-toolbar-right {
        margin-left: auto;
    }

    .tool-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .toolbar {
        padding: 12px 14px;
    }

    .welcome-logo-img {
        width: 124px;
    }

    .welcome-content {
        padding: 28px 18px;
        border-radius: 26px;
    }

    .welcome-prompt-grid,
    .welcome-features {
        grid-template-columns: 1fr;
    }

    .toolbar-home-text,
    .toolbar-kicker {
        display: none;
    }

    .toolbar-home-link {
        padding: 8px 10px;
    }

    .current-model-name {
        font-size: 18px;
    }

    .content-area {
        padding: 0 12px;
    }

    .scroll-bottom-btn {
        right: 16px;
        bottom: 172px;
        padding: 10px 12px;
    }

    .scroll-bottom-btn span {
        display: none;
    }

    .chat-input-box textarea {
        font-size: 16px;
    }

    .chat-input-box.has-reference-stage .input-hint {
        padding-left: 168px;
    }

    .input-hint {
        display: none;
    }

    .toast-container {
        top: auto;
        bottom: 80px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
        font-size: 13px;
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    .message {
        padding: 8px 8px;
        gap: 8px;
    }

    .message-body {
        max-width: 92%;
    }

    .message.user .message-content {
        padding: 8px 12px;
        font-size: 13px;
    }

    .welcome-logo-img {
        width: 80px;
    }

    .welcome-desc {
        font-size: 13px;
    }

    .welcome-feature-item h4 {
        font-size: 13px;
    }

    .welcome-feature-item p {
        font-size: 11px;
    }

    .model-selector h2 {
        font-size: 14px;
    }

    .welcome-prompt-card {
        padding: 16px 14px;
    }

    .scroll-bottom-btn {
        right: 12px;
        bottom: 156px;
    }

    .msg-action-btn {
        padding: 3px 6px;
        font-size: 10px;
    }

    .msg-action-btn svg {
        width: 12px;
        height: 12px;
    }
}

@media (hover: none) {
    .message-actions {
        opacity: 1;
    }
}


/* ==========================================================================
   现代化设置弹窗 (Settings Modern Modal)
   ========================================================================== */
.settings-modern-modal .settings-modal-content {
    max-width: 640px;
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: 0;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-modern-modal .modal-header {
    padding: 24px 32px 20px;
    border-bottom: none;
    position: relative;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.settings-modern-modal .settings-header-text h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-primary);
    background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.settings-modern-modal .settings-header-text p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.settings-modern-modal .close-modal {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    position: relative;
    top: 0;
    right: 0;
}

.settings-modern-modal .close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

/* Tabs */
.settings-modal-tabs {
    display: flex;
    gap: 8px;
    padding: 0 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}

.settings-tab-btn {
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.settings-tab-btn:hover {
    color: var(--text-primary);
}

.settings-tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* Body */
.settings-modern-modal .settings-modal-body {
    padding: 24px 32px 8px;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.settings-modern-modal .settings-modal-body::-webkit-scrollbar {
    width: 6px;
}

.settings-modern-modal .settings-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.settings-modern-modal .settings-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.settings-pane {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-modern-modal .settings-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.settings-modern-modal .settings-group-head {
    margin-bottom: 20px;
}

.settings-modern-modal .settings-group-kicker {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.settings-modern-modal .settings-group-head h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.settings-modern-modal .settings-group-head p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

/* Items */
.settings-modern-modal .setting-item {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-modern-modal .setting-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-modern-modal .setting-item label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 10px;
    display: block;
}

.settings-modern-modal .setting-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: normal;
}

.settings-modern-modal .setting-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.settings-modern-modal .setting-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
    outline: none;
}

.settings-modern-modal .usage-mode-manage-btn {
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-modern-modal .usage-mode-manage-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.settings-modern-modal .setting-range {
    width: 100%;
    margin: 10px 0;
    accent-color: #fff;
}

.settings-modern-modal .setting-range-value {
    font-size: 13px;
    color: var(--text-primary);
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* Footer */
.settings-modern-modal .modal-footer {
    padding: 16px 32px 24px;
    border-top: none;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-modern-modal .settings-footnote {
    font-size: 12px;
    color: var(--text-muted);
}

.settings-modern-modal .btn-primary {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-modern-modal .btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}


/* ==========================================================================
   极致商业化风格: 自定义节点配置弹窗 (Ultra Premium Modal)
   ========================================================================== */
.ultra-premium-modal {
    max-width: 520px;
    background: rgba(14, 14, 16, 0.75);
    backdrop-filter: blur(48px) saturate(150%);
    -webkit-backdrop-filter: blur(48px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 0;
    overflow: hidden;
    animation: upModalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ultra-premium-modal-sm {
    max-width: 440px;
}

@keyframes upModalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.blur-overlay {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.up-modal-header {
    padding: 28px 32px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}

.up-modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 32px;
    right: 32px;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, transparent 100%);
}

.up-header-titles h3 {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.up-header-titles p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.up-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.up-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.up-modal-body {
    padding: 24px 32px 32px;
}

/* 状态卡片 */
.up-status-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.up-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.up-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.up-status-dot.active {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: upPulse 2s infinite;
}

@keyframes upPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.up-status-value {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

/* 列表项 */
.up-key-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.up-key-list::-webkit-scrollbar {
    width: 4px;
}

.up-key-list::-webkit-scrollbar-track {
    background: transparent;
}

.up-key-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.up-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.3s ease;
}

.up-key-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.up-key-item.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.up-key-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.up-key-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    display: flex;
    align-items: center;
}

.up-key-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.up-key-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.up-key-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.up-key-item:hover .up-key-actions,
.up-key-item.active .up-key-actions {
    opacity: 1;
    transform: translateX(0);
}

/* 空状态 */
.up-empty-state {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.up-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
}

.up-empty-state h4 {
    color: #fff;
    font-size: 14px;
    margin: 0 0 6px;
    font-weight: 500;
}

.up-empty-state p {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    margin: 0;
}

/* 底部操作栏 */
.up-modal-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.up-link-muted {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.2s;
}

.up-link-muted:hover {
    color: #fff;
}

/* 高亮获取 API Key 链接 */
.up-link-highlight {
    font-size: 12px;
    font-weight: 500;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.up-link-highlight:hover {
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* 表单区 */
.up-form-group {
    margin-bottom: 0;
}

.up-form-group label {
    display: none;
}

.up-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.up-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.up-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.up-input-wrapper {
    position: relative;
}

.up-input-icon-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.up-input-icon-btn:hover {
    color: #fff;
}

.up-modal-footer {
    padding: 20px 32px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 按钮体系 */
.up-btn-primary {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.up-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.up-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 禁用状态的按钮 */
.up-btn-secondary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    border-color: transparent;
}

.up-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.up-btn-ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.up-btn-ghost:hover {
    background: #fff;
    color: #000;
}

.up-btn-icon {
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.up-btn-icon:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
/* ==========================================================================
   全屏沉浸与悬浮 UI (Toolbar Replacement)
   ========================================================================== */

.content-area {
    padding-top: 0 !important;
}

.float-mobile-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(20px);
}
@media (max-width: 768px) {
    .float-mobile-btn {
        display: flex;
    }
}

.top-model-capsule {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 12px;
    background: rgba(20, 20, 22, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}
.top-model-capsule:hover {
    background: rgba(30, 30, 32, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.top-model-capsule .model-selector-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}
.top-model-capsule .current-model-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

.top-action-wrapper {
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 100;
}
.top-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(20, 20, 22, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.top-action-btn:hover {
    background: rgba(30, 30, 32, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.top-action-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 260px;
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top right;
}

@keyframes popoverFadeIn {
    0% { opacity: 0; transform: scale(0.95) translateY(-10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.action-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
}
.action-grid-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-grid-item svg {
    color: currentColor;
    transition: all 0.2s ease;
}

.action-grid-item:hover svg {
    transform: scale(1.1);
}

.action-grid-item span {
    font-size: 12px;
    font-weight: 500;
}

.action-grid-item.danger-item:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* === 新功能菜单：渐变描边卡片（一排两个） === */
.action-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: none;
    text-align: left;
    width: 100%;
    color: inherit;
    font: inherit;
}

/* 渐变描边 */
.action-menu-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: background 0.3s ease;
    pointer-events: none;
}

.action-menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: scale(1.02);
}

/* hover时彩色渐变边框 */
.action-menu-item.item-blue:hover::before    { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.action-menu-item.item-indigo:hover::before   { background: linear-gradient(135deg, #6366f1, #818cf8); }
.action-menu-item.item-amber:hover::before    { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.action-menu-item.item-emerald:hover::before { background: linear-gradient(135deg, #10b981, #34d399); }
.action-menu-item.item-cyan:hover::before    { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.action-menu-item.item-rose:hover::before    { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.action-menu-item.item-violet:hover::before   { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

/* 图标 */
.action-menu-item .menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.action-menu-item:hover .menu-icon {
    transform: translateY(-4px) scale(1.1);
}
/* 深色模式 hover：图标彩色发光 */
.action-menu-item.item-blue:hover .menu-icon    { box-shadow: 0 0 20px rgba(59,130,246,0.5); }
.action-menu-item.item-indigo:hover .menu-icon   { box-shadow: 0 0 20px rgba(99,102,241,0.5); }
.action-menu-item.item-amber:hover .menu-icon    { box-shadow: 0 0 20px rgba(245,158,11,0.5); }
.action-menu-item.item-emerald:hover .menu-icon { box-shadow: 0 0 20px rgba(16,185,129,0.5); }
.action-menu-item.item-cyan:hover .menu-icon    { box-shadow: 0 0 20px rgba(6,182,212,0.5); }
.action-menu-item.item-rose:hover .menu-icon    { box-shadow: 0 0 20px rgba(244,63,94,0.5); }
.action-menu-item.item-violet:hover .menu-icon   { box-shadow: 0 0 20px rgba(139,92,246,0.5); }
.action-menu-item .icon-blue    { background: rgba(59,130,246,0.1);  color: #3b82f6; }
.action-menu-item .icon-indigo   { background: rgba(99,102,241,0.1);  color: #6366f1; }
.action-menu-item .icon-amber    { background: rgba(245,158,11,0.1);  color: #f59e0b; }
.action-menu-item .icon-emerald { background: rgba(16,185,129,0.1);  color: #10b981; }
.action-menu-item .icon-cyan    { background: rgba(6,182,212,0.1);   color: #06b6d4; }
.action-menu-item .icon-rose    { background: rgba(244,63,94,0.1);   color: #f43f5e; }
.action-menu-item .icon-violet   { background: rgba(139,92,246,0.1);   color: #8b5cf6; }

/* 文字 */
.action-menu-item .menu-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.action-menu-item .menu-name {
    font-size: 14px;
    font-weight: 600;
    color: #f3f4f6;
    transition: color 0.3s;
}
.action-menu-item .menu-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* hover时名称变色 */
.action-menu-item.item-blue:hover .menu-name    { color: #60a5fa; }
.action-menu-item.item-indigo:hover .menu-name   { color: #818cf8; }
.action-menu-item.item-amber:hover .menu-name    { color: #fbbf24; }
.action-menu-item.item-emerald:hover .menu-name { color: #34d399; }
.action-menu-item.item-cyan:hover .menu-name    { color: #22d3ee; }
.action-menu-item.item-rose:hover .menu-name    { color: #fb7185; }
.action-menu-item.item-violet:hover .menu-name   { color: #a78bfa; }

/* 响应式：窄屏时一排一个 */
@media (max-width: 420px) {
    .action-menu-grid {
        grid-template-columns: 1fr;
    }
}

.history-panel {
    position: absolute !important;
    top: 70px !important;
    right: 24px !important;
    z-index: 90 !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
}

/* 用户不需要顶部的模型名称了 */
.top-model-capsule {
    display: none !important;
}

/* 居中大弹窗样式 (公告等) */
.ms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ms-modal {
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    background: rgba(15, 15, 18, 0.75);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(40px) perspective(1000px) rotateX(10deg);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   联系客服迷你弹窗 (Contact Mini Modal)
   ========================================================================== */
.ms-contact-modal {
    width: 90%;
    max-width: 420px; /* 增加宽度以适应新的排版 */
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.ms-modal-overlay.active .ms-contact-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* 顶部背景渐变光效 */
.ms-contact-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: radial-gradient(circle at center top, rgba(102, 126, 234, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.ms-contact-header {
    padding: 20px 24px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ms-contact-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.ms-contact-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.ms-contact-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.contact-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    object-fit: contain;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.contact-name {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.contact-subtitle {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.ms-contact-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.ms-contact-qr-wrapper {
    width: 160px;
    height: 160px;
    background: #fff;
    border-radius: 16px;
    padding: 10px;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.ms-contact-qr-wrapper:hover {
    transform: scale(1.05);
}

.ms-contact-qr-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.contact-qr-hint {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.ms-contact-cards {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    transition: all 0.3s;
}

.contact-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
}

.card-icon svg { width: 20px; height: 20px; }

.wechat-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.time-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.card-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.info-value {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #10b981;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.copy-btn:hover {
    background: #059669;
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background: #3b82f6;
}
@keyframes modalNebulaBreathe {
    0%, 100% { box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 60px rgba(102, 126, 234, 0.15), inset 0 1px 0 rgba(255,255,255,0.1); }
    50% { box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 120px rgba(118, 75, 162, 0.3), inset 0 1px 0 rgba(255,255,255,0.15); }
}

.ms-modal-overlay.active .ms-modal {
    transform: scale(1) translateY(0) perspective(1000px) rotateX(0deg);
    opacity: 1;
    animation: modalNebulaBreathe 4s ease-in-out infinite alternate;
    animation-delay: 0.5s;
}

.ms-modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.ms-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ms-modal-icon {
    color: #fff;
    opacity: 0.9;
    transform-origin: top center;
    animation: bellRing 5s ease-in-out infinite;
}

@keyframes bellRing {
    0%, 20%, 100% { transform: rotate(0); }
    5% { transform: rotate(15deg); }
    10% { transform: rotate(-15deg); }
    15% { transform: rotate(10deg); }
}

/* 标题金属扫光 */
@keyframes shineSweep {
    to { background-position: 200% center; }
}

.ms-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 20%, #888 40%, #fff 60%, #888 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
    animation: shineSweep 3s linear infinite;
}

.ms-modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #999;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.ms-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

.ms-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* 隐藏滚动条 */
.ms-modal-body::-webkit-scrollbar {
    width: 6px;
}
.ms-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.ms-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

/* 卡片进场动画 */
@keyframes cardFadeUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.ms-notice-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: cardFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 为前几个卡片添加延迟错落效果 */
.ms-notice-card:nth-child(1) { animation-delay: 0.1s; }
.ms-notice-card:nth-child(2) { animation-delay: 0.2s; }
.ms-notice-card:nth-child(3) { animation-delay: 0.3s; }
.ms-notice-card:nth-child(4) { animation-delay: 0.4s; }
.ms-notice-card:nth-child(5) { animation-delay: 0.5s; }
.ms-notice-card:nth-child(n+6) { animation-delay: 0.6s; }

/* 鼠标悬停扫光与浮起 */
.ms-notice-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
    pointer-events: none;
}

.ms-notice-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255,255,255,0.02);
}

.ms-notice-card:hover::before {
    left: 200%;
    transition: 0.7s ease-in-out;
}

.ms-notice-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
}

.ms-notice-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ms-notice-pin {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #f59e0b;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.ms-notice-date {
    color: #666;
}

.ms-notice-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.ms-notice-badge.type-new {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.ms-notice-badge.type-update {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.ms-notice-badge.type-urgent {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulseBorder 2s infinite;
}

.ms-notice-badge.type-notice {
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.ms-notice-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.ms-notice-content {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.6;
}

.ms-notice-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
    display: block;
    background-color: rgba(255, 255, 255, 0.05);
    min-height: 100px; /* 防止加载失败时太难看 */
    object-fit: cover;
}

.ms-notice-content p {
    margin: 0 0 10px 0;
}
.ms-notice-content p:last-child {
    margin-bottom: 0;
}

.ms-empty-state {
    text-align: center;
    color: #666;
    padding: 40px 0;
    font-size: 14px;
}

/* ==========================================================================
   ★ 高级按钮升级 — 右上角功能菜单 & 左上角控制台
   ========================================================================== */

/* --- 右上角主按钮 (网格图标) --- */
.top-action-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(30, 30, 36, 0.8), rgba(18, 18, 22, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.top-action-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: conic-gradient(from 0deg, #6366f1, #8b5cf6, #ec4899, #f59e0b, #10b981, #6366f1);
    opacity: 0.5;
    z-index: -1;
    filter: blur(6px);
    animation: actionBtnSpin 6s linear infinite;
}

.top-action-btn::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(30, 30, 36, 0.95), rgba(18, 18, 22, 0.98));
    z-index: 0;
}

.top-action-btn > svg {
    position: relative;
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.top-action-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.25);
}

.top-action-btn:hover::before {
    opacity: 0.8;
    animation: actionBtnSpin 3s linear infinite;
}

.top-action-btn:hover > svg {
    transform: rotate(90deg) scale(1.05);
    color: #a5b4fc;
}

.top-action-btn.active {
    border-color: rgba(139, 92, 246, 0.4);
}

.top-action-btn.active::before {
    opacity: 0.6;
    animation: actionBtnSpin 4s linear infinite;
}

@keyframes actionBtnSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- 弹窗面板增强 --- */
.action-popover {
    width: 380px;
    border-radius: 22px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: popoverFadeInPro 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popoverFadeInPro {
    0% { opacity: 0; transform: scale(0.92) translateY(-12px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.action-grid {
    gap: 10px;
}

/* --- 弹窗内按钮基础 --- */
.action-grid-item {
    padding: 18px 8px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-grid-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.action-grid-item span {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.3s ease;
}

/* --- ★ 彩色渐变图标底座 (默认就有颜色) --- */
.action-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    color: #fff;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.action-icon-badge svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.action-icon-badge::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 50%);
    pointer-events: none;
}

/* --- 各图标渐变配色 --- */
.badge-indigo {
    background: linear-gradient(135deg, #6366f1, #818cf8, #a5b4fc);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.badge-amber {
    background: linear-gradient(135deg, #f59e0b, #fbbf24, #fcd34d);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

.badge-emerald {
    background: linear-gradient(135deg, #10b981, #34d399, #6ee7b7);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.badge-cyan {
    background: linear-gradient(135deg, #06b6d4, #22d3ee, #67e8f9);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.35);
}

.badge-rose {
    background: linear-gradient(135deg, #f43f5e, #fb7185, #fda4af);
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.35);
}

.badge-violet {
    background: linear-gradient(135deg, #7c3aed, #a78bfa, #c4b5fd);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

/* --- 偏好设置: 蓝紫 --- */
#settingsBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.2), transparent 70%);
}
#settingsBtn:hover {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.18);
}
#settingsBtn:hover::before { opacity: 1; }
#settingsBtn:hover .action-icon-badge { transform: scale(1.1) rotate(60deg); box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5); }
#settingsBtn:hover span { color: #c7d2fe; }

/* --- 系统公告: 琥珀金 --- */
#noticeBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(245, 158, 11, 0.2), transparent 70%);
}
#noticeBtn:hover {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.18);
}
#noticeBtn:hover::before { opacity: 1; }
#noticeBtn:hover .action-icon-badge { transform: scale(1.1) rotate(-12deg); box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5); }
#noticeBtn:hover span { color: #fde68a; }

/* --- 资产库: 翡翠绿 --- */
#worksBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(16, 185, 129, 0.2), transparent 70%);
}
#worksBtn:hover {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.18);
}
#worksBtn:hover::before { opacity: 1; }
#worksBtn:hover .action-icon-badge { transform: scale(1.1) translateY(-3px); box-shadow: 0 6px 24px rgba(16, 185, 129, 0.5); }
#worksBtn:hover span { color: #a7f3d0; }

/* --- 我的作品: 青色 --- */
#assetHistoryBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(6, 182, 212, 0.2), transparent 70%);
}
#assetHistoryBtn:hover {
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.18);
}
#assetHistoryBtn:hover::before { opacity: 1; }
#assetHistoryBtn:hover .action-icon-badge { transform: scale(1.1) rotate(20deg); box-shadow: 0 6px 24px rgba(6, 182, 212, 0.5); }
#assetHistoryBtn:hover span { color: #a5f3fc; }

/* --- 联系客服: 玫瑰粉 --- */
#contactBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(244, 63, 94, 0.2), transparent 70%);
}
#contactBtn:hover {
    border-color: rgba(244, 63, 94, 0.35);
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.18);
}
#contactBtn:hover::before { opacity: 1; }
#contactBtn:hover .action-icon-badge { transform: scale(1.12); box-shadow: 0 6px 24px rgba(244, 63, 94, 0.5); }
#contactBtn:hover span { color: #fda4af; }

/* --- 历史对话: 紫罗兰 --- */
#historyBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(124, 58, 237, 0.2), transparent 70%);
}
#historyBtn:hover {
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.18);
}
#historyBtn:hover::before { opacity: 1; }
#historyBtn:hover .action-icon-badge { transform: scale(1.1) rotate(360deg); box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5); }
#historyBtn:hover span { color: #c4b5fd; }

/* --- 接入模式: 天蓝 --- */
#modeSelectorEntry::before {
    background: radial-gradient(circle at 50% 30%, rgba(59, 130, 246, 0.2), transparent 70%);
}
#modeSelectorEntry:hover {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.18);
}
#modeSelectorEntry:hover::before { opacity: 1; }
#modeSelectorEntry:hover .action-icon-badge { transform: scale(1.1) rotate(-15deg); box-shadow: 0 6px 24px rgba(59, 130, 246, 0.5); }
#modeSelectorEntry:hover span { color: #93c5fd; }

/* --- 签到任务: radial-gradient模糊发光 --- */
#checkinTaskBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(245, 158, 11, 0.2), transparent 70%);
}
#checkinTaskBtn:hover::before { opacity: 1; }

/* --- 主题切换: radial-gradient模糊发光 --- */
#themeToggleBtn::before {
    background: radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.2), transparent 70%);
}
#themeToggleBtn:hover::before { opacity: 1; }

/* --- 左上角控制台按钮增强 --- */
.top-left-console {
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(20, 20, 24, 0.7), rgba(14, 14, 16, 0.8));
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.top-left-console:hover {
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow:
        0 6px 28px rgba(99, 102, 241, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.console-btn {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

#consoleHistoryBtn:hover {
    background: rgba(129, 140, 248, 0.12);
    color: #a5b4fc;
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.2);
}

#consoleHistoryBtn:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 0 4px rgba(165, 180, 252, 0.5));
}

#consoleNewChatBtn:hover {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.2);
}

#consoleNewChatBtn:hover svg {
    transform: scale(1.1) rotate(90deg);
    filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.5));
}

#consoleNewChatBtn svg,
#consoleHistoryBtn svg {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}

.console-divider {
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

/* === 骨架屏：JS 初始化前的占位 === */
.app-skeleton {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    background: #0a0a0a;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-skeleton.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* 骨架占位块通用样式 */
.sk {
    background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes sk-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 左侧栏骨架 */
.app-skeleton .sk-sidebar {
    width: 260px;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
}

.app-skeleton .sk-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.app-skeleton .sk-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.app-skeleton .sk-logo-text {
    width: 80px;
    height: 20px;
    border-radius: 4px;
}

.app-skeleton .sk-nav-item {
    width: 100%;
    height: 38px;
}

/* 主区域骨架 */
.app-skeleton .sk-main {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.app-skeleton .sk-header-bar {
    width: 100%;
    height: 48px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-skeleton .sk-model-chip {
    width: 180px;
    height: 36px;
    border-radius: 18px;
}

.app-skeleton .sk-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.app-skeleton .sk-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 0 20px;
    overflow: hidden;
}

.app-skeleton .sk-msg-row {
    height: 16px;
    border-radius: 4px;
}

.app-skeleton .sk-input-bar {
    width: 100%;
    height: 56px;
    margin-top: 20px;
    border-radius: 16px;
}

/* 移动端：隐藏侧栏骨架 */
@media (max-width: 768px) {
    .app-skeleton .sk-sidebar {
        display: none;
    }
}

/* ==========================================================================
   模式选择按钮 + 弹窗 (方案B - 左右分栏)
   ========================================================================== */

/* 功能菜单中的 badge-blue */
.badge-blue {
    background: linear-gradient(135deg, #3b82f6, #60a5fa, #93c5fd);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

/* 功能菜单中的 badge-theme (主题切换：暖阳→冷月渐变) */
.badge-theme {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 35%, #6366f1 100%);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}

.mode-selector-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 40px;
    border-radius: 12px;
    background: rgba(20, 20, 22, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.mode-selector-btn:hover {
    background: rgba(30, 30, 32, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.mode-selector-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    flex-shrink: 0;
}

.mode-selector-label {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* 弹窗遮罩 */
.mode-selector-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* 弹窗主体 - 左右分栏 */
.mode-selector-modal {
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    background: rgba(12, 12, 14, 0.92);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
    display: grid;
    grid-template-columns: 260px 1fr;
    animation: msFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* === 左侧栏 === */
.ms-modal-left {
    padding: 28px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
}

.ms-left-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ms-left-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 20px;
}

/* 左侧模式卡片 */
.ms-side-card {
    position: relative;
    padding: 16px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.ms-side-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ms-side-card.selected {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

.ms-side-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ms-side-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ms-icon-platform {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    color: #818cf8;
}

.ms-icon-api {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    color: #34d399;
}

.ms-side-card h3 {
    font-size: 14px;
    font-weight: 600;
}

.ms-side-card > p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
}

/* 选中标记圆圈 */
.ms-side-check {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s;
}

.ms-side-card.selected .ms-side-check {
    border-color: #fff;
    background: #fff;
}

.ms-side-card.selected .ms-side-check::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #000;
}

/* 标签 */
.ms-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.ms-tag-recommend {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.ms-tag-advanced {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* === 右侧栏 === */
.ms-modal-right {
    padding: 28px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ms-modal-right::-webkit-scrollbar {
    width: 4px;
}

.ms-modal-right::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* 详情面板 */
.ms-detail-pane {
    display: none;
    animation: msPaneFade 0.3s ease;
}

.ms-detail-pane.active {
    display: block;
}

@keyframes msPaneFade {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

.ms-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.ms-detail-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.ms-detail-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
    margin-bottom: 20px;
}

.ms-detail-features {
    list-style: none;
    margin-bottom: 20px;
}

.ms-detail-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    padding: 6px 0;
}

.ms-detail-features li svg {
    color: var(--success);
    flex-shrink: 0;
}

/* === API 配置区 === */
.ms-api-config {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 20px;
}

.ms-config-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ms-config-head h4 {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ms-get-key-link {
    font-size: 12px;
    color: #818cf8;
    text-decoration: none;
    transition: opacity 0.2s;
}

.ms-get-key-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* 已有节点列表 */
.ms-key-list {
    margin-bottom: 16px;
}

.ms-key-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 6px;
    transition: all 0.2s;
}

.ms-key-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ms-key-item.active {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.ms-key-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ms-key-dot.active {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.ms-key-dot.inactive {
    background: rgba(255, 255, 255, 0.3);
}

.ms-key-info {
    flex: 1;
    min-width: 0;
}

.ms-key-name {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ms-key-name .ms-active-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.ms-key-url {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

.ms-key-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.ms-key-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ms-key-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.ms-key-action-btn.danger:hover {
    color: #ef4444;
}

.ms-key-switch-btn {
    font-size: 11px;
    padding: 0 8px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ms-key-switch-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.ms-key-empty {
    text-align: center;
    padding: 20px 10px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
}

/* 添加节点表单 */
.ms-add-key-form {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ms-form-field {
    margin-bottom: 14px;
}

.ms-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 6px;
}

.ms-form-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
}

.ms-form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.ms-form-input:focus {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
}

.ms-input-wrap {
    position: relative;
}

.ms-toggle-visible {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms-toggle-visible:hover {
    color: #fff;
}

.ms-btn-add-key {
    width: 100%;
    padding: 11px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ms-btn-add-key:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* === 底部按钮 === */
.ms-modal-footer {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ms-btn-cancel,
.ms-btn-confirm {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.ms-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ms-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.ms-btn-confirm {
    background: #fff;
    color: #000;
    font-weight: 600;
}

.ms-btn-confirm:hover {
    background: #f0f0f0;
}

/* === 响应式 === */
@media (max-width: 640px) {
    .mode-selector-modal {
        grid-template-columns: 1fr;
        max-height: 85vh;
    }

    .ms-modal-left {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: 20px;
    }

    .ms-left-desc {
        margin-bottom: 12px;
    }

    .ms-side-card {
        margin-bottom: 8px;
    }

    .ms-modal-right {
        padding: 20px;
    }

    .mode-selector-label {
        display: none;
    }

    .mode-selector-btn {
        padding: 0 10px;
    }
}

/* ============================================================================
   浅色模式 (body.theme-light) — 完整覆盖
   仅在 body 拥有 theme-light 类时生效，不影响深色模式
   ============================================================================ */

/* ── P0: 根变量覆盖 ── */
body.theme-light {
    --bg-primary: #f5f6f8;
    --bg-secondary: #ffffff;
    --bg-sidebar: rgba(255, 255, 255, 0.88);
    --bg-input: rgba(255, 255, 255, 0.75);
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.06);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.04);
    --text-primary: #1a1a2e;
    --text-secondary: rgba(0, 0, 0, 0.58);
    --text-muted: rgba(0, 0, 0, 0.38);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.1);
    --danger: #ef4444;
    --success: #10b981;
    --thinking-color: #d97706;
    --search-color: #059669;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.1);
}

/* ── P0: 全局背景 ── */
body.theme-light.chat-shell {
    background: #f5f6f8;
    color: #1a1a2e;
}
body.theme-light .app-container {
    background: #f5f6f8;
    color: #1a1a2e;
}
body.theme-light .main-content {
    background: #ffffff;
}
body.theme-light .toolbar {
    background: rgba(255, 255, 255, 0.6);
}
body.theme-light .toolbar::after {
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.08), transparent);
}

/* ── 星空画布：浅色模式隐藏 ── */
body.theme-light #starCanvas {
    display: none;
}

/* ── P0: Logo 混合模式修复 ── */
body.theme-light .logo-img,
body.theme-light .welcome-logo-img {
    mix-blend-mode: normal;
}
body.theme-light .logo-text {
    color: #1a1a2e;
}

/* ── P0: 侧边栏 ── */
body.theme-light .sidebar {
    background: rgba(255, 255, 255, 0.88);
    box-shadow: none;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .sidebar-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .toggle-sidebar {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
}

/* API key 配置卡片 */
body.theme-light .key-config-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
}
body.theme-light .apikey-section.platform-mode .key-config-card {
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.03);
}
body.theme-light .apikey-section.byok-mode .key-config-card {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}
body.theme-light .key-config-btn:hover {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .key-config-icon {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.02) 100%);
    color: #6366f1;
}
body.theme-light .key-config-btn:hover .key-config-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%);
    color: #4f46e5;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* 路由卡片 */
body.theme-light .route-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
}
body.theme-light .route-mode-chip,
body.theme-light .route-card-badge {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .route-card-status {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .route-switch-btn {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .route-switch-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}
body.theme-light .route-switch-btn.active {
    color: #ffffff;
    background: #1a1a2e;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
body.theme-light .route-strategy-desc {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .route-trigger-btn {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
}
body.theme-light .route-trigger-btn:hover {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.05);
}
body.theme-light .route-trigger-btn.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}
body.theme-light .route-trigger-icon {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .route-trigger-price {
    color: rgba(0, 0, 0, 0.4);
}

/* 模型分类标签 */
body.theme-light .model-tabs {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .tab-item {
    color: rgba(0, 0, 0, 0.42);
}
body.theme-light .tab-item:hover {
    color: rgba(0, 0, 0, 0.8);
}
body.theme-light .tab-item.active {
    background: #1a1a2e;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
body.theme-light .tab-item-workshop {
    color: rgba(0, 0, 0, 0.42);
}

/* 模型搜索 */
body.theme-light .model-search-icon {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .model-search-input {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.85);
}
body.theme-light .model-search-input:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(0, 0, 0, 0.02);
}

/* 模型列表 */
body.theme-light .model-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}
body.theme-light .model-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}
body.theme-light .model-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}
body.theme-light .model-item.active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}
body.theme-light .model-item.active::before {
    background: #6366f1;
}
body.theme-light .model-item::before {
    background: #1a1a2e;
}
body.theme-light .model-name {
    color: #1a1a2e;
}
body.theme-light .model-desc {
    color: rgba(0, 0, 0, 0.45);
}
body.theme-light .cap-tag {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.5);
}

/* 侧边栏底部 */
body.theme-light .sidebar-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.38);
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.015) 100%);
}

/* 钱包卡片 */
body.theme-light .wallet-user-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.06) 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
}
body.theme-light .wallet-user-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.1);
}
body.theme-light .wallet-name {
    color: #1a1a2e;
}
body.theme-light .wallet-amount-wrap {
    color: #6366f1;
}
body.theme-light .wallet-amount {
    color: #6366f1;
}
body.theme-light .wallet-recharge-btn {
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
body.theme-light .wallet-recharge-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* ── P0: 消息区 ── */
body.theme-light .messages-container {
    color: #1a1a2e;
}
body.theme-light .message-content {
    color: #1a1a2e;
}
body.theme-light .message.user .message-content {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.12);
    color: #1a1a2e;
}
body.theme-light .message.assistant .message-content {
    background: transparent;
    border: none;
    color: #1a1a2e;
}

/* 消息头像 */
body.theme-light .user-avatar,
body.theme-light .message.user .message-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
body.theme-light .message.assistant .message-avatar {
    background-color: #ffffff;
    background-image: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
body.theme-light .msg-avatar-img.is-openai-white {
    filter: none;
}

/* 消息时间 */
body.theme-light .message-time {
    color: rgba(0, 0, 0, 0.35);
}

/* 消息计费 */
body.theme-light .message-billing,
body.theme-light .message-billing .billing-label,
body.theme-light .message-billing .billing-value,
body.theme-light .message-billing .billing-cost {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .message-billing .billing-dot {
    color: rgba(0, 0, 0, 0.2);
}
body.theme-light .message-billing .billing-currency {
    color: #d97706;
}

/* 消息图片/文件 */
body.theme-light .message-img {
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .message-file {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .message-file-icon {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}
body.theme-light .message-file-name {
    color: #1a1a2e;
}

/* 消息操作按钮 */
body.theme-light .message-actions button,
body.theme-light .msg-action-btn {
    color: rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .message-actions button:hover,
body.theme-light .msg-action-btn:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.08);
}

/* 思考动画 */
body.theme-light .thinking-dots span {
    background: rgba(0, 0, 0, 0.35);
}
body.theme-light .thinking-section {
    border-left: 2px solid rgba(99, 102, 241, 0.3);
}
body.theme-light .thinking-header:hover {
    background: rgba(99, 102, 241, 0.04);
}
body.theme-light .thinking-chip {
    color: #6366f1;
}
body.theme-light .thinking-level {
    color: rgba(79, 70, 229, 0.72);
}
body.theme-light .thinking-status {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .thinking-toggle {
    color: rgba(0, 0, 0, 0.3);
}
body.theme-light .thinking-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .thinking-body {
    color: rgba(0, 0, 0, 0.6);
}

/* 搜索指示器 */
body.theme-light .search-indicator {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #059669;
}

/* ── P0: 输入区域 ── */
body.theme-light .input-area {
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.5) 20%, rgba(255, 255, 255, 0.9) 100%);
}
body.theme-light .chat-input-box {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.88));
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06), 0 1px 0 rgba(0, 0, 0, 0.02) inset;
}
body.theme-light .chat-input-box.composer-collapsed {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}
body.theme-light .chat-input-box:focus-within {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08), 0 4px 20px rgba(0, 0, 0, 0.08);
}
body.theme-light .chat-input-box.dragging {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08), 0 8px 30px rgba(0, 0, 0, 0.08);
}
body.theme-light .chat-input-box.is-generating {
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .chat-input-box textarea,
body.theme-light .chat-input-box .rich-input {
    color: #1a1a2e;
    caret-color: #1a1a2e;
}
body.theme-light .chat-input-box textarea::placeholder,
body.theme-light .chat-input-box .rich-input.is-empty::before {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .input-hint {
    color: rgba(0, 0, 0, 0.35);
}

/* 工具栏按钮 */
body.theme-light .tool-btn {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .tool-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .toggle-tool {
    border: 1px solid rgba(0, 0, 0, 0.07);
    background: rgba(0, 0, 0, 0.025);
}
body.theme-light .toggle-tool:hover {
    background-color: rgba(0, 0, 0, 0.06);
}
body.theme-light .toggle-tool.active {
    background-color: rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .toggle-tool.active.web-search {
    background-color: rgba(16, 185, 129, 0.1);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.25);
}
body.theme-light .toggle-tool.active.thinking-mode {
    background: rgba(217, 119, 7, 0.1);
    color: #92520d;
    border-color: rgba(217, 119, 7, 0.25);
}

/* 发送/停止按钮 */
body.theme-light .send-btn {
    background: linear-gradient(180deg, #6366f1, #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
body.theme-light .send-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #4f46e5, #4338ca);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}
body.theme-light .send-btn:disabled {
    background-color: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.3);
    box-shadow: none;
}
body.theme-light .stop-btn {
    background-color: #ef4444;
    color: #fff;
}
body.theme-light .stop-btn:hover {
    background-color: #dc2626;
}

/* 拖拽上传遮罩 */
body.theme-light .drag-overlay {
    background: rgba(99, 102, 241, 0.06);
    border: 2px dashed rgba(99, 102, 241, 0.4);
}
body.theme-light .drag-overlay-content {
    color: #1a1a2e;
}

/* 参考图区 */
body.theme-light .empty-reference-trigger {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.01)), rgba(0, 0, 0, 0.02);
    border: 1px dashed rgba(0, 0, 0, 0.18);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
body.theme-light .empty-reference-trigger:hover {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.02)), rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
body.theme-light .reference-stage.has-images .empty-reference-trigger {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
body.theme-light .reference-stage.has-images .empty-reference-trigger:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
}
body.theme-light .empty-reference-content {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .preview-item-add {
    border: 1px dashed rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
body.theme-light .preview-item-add:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}
body.theme-light .preview-item-add .empty-reference-content {
    color: rgba(0, 0, 0, 0.4);
}

/* 价格标签 */
body.theme-light .chat-price-badge {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
}

/* 角色状态条 */
body.theme-light .role-status-chip {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: #6366f1;
}
body.theme-light .role-status-close {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .role-status-close:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.06);
}

/* 图片引用自动补全 */
body.theme-light .img-ref-autocomplete {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
}
body.theme-light .img-ref-menu-head {
    border-bottom-color: rgba(15, 23, 42, 0.08);
}
body.theme-light .img-ref-menu-title,
body.theme-light .img-ref-title {
    color: #1f2937;
}
body.theme-light .img-ref-menu-desc,
body.theme-light .img-ref-item .img-ref-name {
    color: #7c8595;
}
body.theme-light .img-ref-item:hover,
body.theme-light .img-ref-item.is-active {
    background: rgba(15, 23, 42, 0.055);
}
body.theme-light .img-ref-item .img-ref-tag {
    border-color: rgba(79, 70, 229, 0.16);
    background: rgba(99, 102, 241, 0.09);
    color: #4f46e5;
}

/* 骨架屏 */
body.theme-light .app-skeleton .sk {
    background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.04) 75%);
    background-size: 200% 100%;
}

/* ── P1: Markdown 渲染 ── */
body.theme-light .message-content a {
    color: #6366f1;
}
body.theme-light .message-content .inline-code {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: #4f46e5;
}
body.theme-light .code-block {
    background: #f6f8fa;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
body.theme-light .code-block pre {
    background: transparent;
}
body.theme-light .code-block code {
    color: #24292f;
}
body.theme-light .code-header {
    background: rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .code-lang {
    color: #6a737d;
}
body.theme-light .code-copy {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .code-copy:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.08);
}
body.theme-light .message-content blockquote {
    border-left: 2px solid rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.04);
    color: #57606a;
}
body.theme-light .message-content hr {
    background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.12) 50%, transparent 100%);
}
body.theme-light .table-wrap {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.03);
}
body.theme-light .table-wrap th,
body.theme-light .table-wrap td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .table-wrap th {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .table-wrap td {
    color: #57606a;
}
body.theme-light .message-content strong {
    color: #1a1a2e;
}
body.theme-light .message-content h2,
body.theme-light .message-content h3,
body.theme-light .message-content h4 {
    color: #1a1a2e;
}

/* ── P1: 悬浮 UI ── */
body.theme-light .top-model-capsule {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
body.theme-light .top-model-capsule:hover {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
body.theme-light .top-model-capsule .current-model-name {
    color: #1a1a2e;
}
body.theme-light .current-model-type {
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

body.theme-light .top-action-btn {
    background: rgba(255, 255, 255, 0.72) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #1a1a2e !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}
/* 关键修复：隐藏 ::before 彩色光圈和 ::after 深色渐变伪元素 */
body.theme-light .top-action-btn::before {
    display: none !important;
    opacity: 0 !important;
    background: none !important;
}
body.theme-light .top-action-btn::after {
    display: none !important;
    background: none !important;
}
body.theme-light .top-action-btn:hover {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12) !important;
    transform: translateY(-2px);
}
body.theme-light .top-action-btn:hover > svg {
    color: #6366f1 !important;
}
body.theme-light .top-action-btn.active {
    background: rgba(99, 102, 241, 0.08) !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
}

body.theme-light .float-mobile-btn {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}

body.theme-light .top-left-console {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
body.theme-light .top-left-console:hover {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .console-btn {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .console-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
}
body.theme-light .console-divider {
    background: rgba(0, 0, 0, 0.1);
}

body.theme-light .action-popover {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
body.theme-light .action-grid-item {
    color: #1a1a2e;
}
body.theme-light .action-grid-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .action-grid-item span {
    color: #1a1a2e;
}
body.theme-light .action-grid-item:hover span {
    color: #1a1a2e;
}

/* mode-selector-btn */
body.theme-light .mode-selector-btn {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
body.theme-light .mode-selector-btn:hover {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ── P1: 欢迎屏 ── */
body.theme-light .welcome-content {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background:
        radial-gradient(circle at top, rgba(99, 102, 241, 0.06), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(248, 250, 252, 0.8) 100%);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}
body.theme-light .welcome-brand-title {
    background: linear-gradient(to right, #999 0%, #1a1a2e 40%, #1a1a2e 60%, #999 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
body.theme-light .welcome-eyebrow {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
}
body.theme-light .welcome-content h2 {
    color: rgba(0, 0, 0, 0.6);
}
body.theme-light .welcome-desc {
    color: rgba(0, 0, 0, 0.55) !important;
}
body.theme-light .welcome-prompt-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .welcome-prompt-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.04);
}
body.theme-light .welcome-prompt-label {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .welcome-prompt-card strong {
    color: #1a1a2e;
}
body.theme-light .welcome-meta-chip {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.07);
    color: rgba(0, 0, 0, 0.65);
}
body.theme-light .welcome-feature-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .feature-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
    color: #6366f1;
}
body.theme-light .welcome-feature-item h4 {
    color: #1a1a2e;
}
body.theme-light .welcome-feature-item p {
    color: rgba(0, 0, 0, 0.5);
}

/* ── P2: 历史抽屉 ── */
body.theme-light .history-drawer {
    background: rgba(255, 255, 255, 0.92);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.08);
}
body.theme-light .history-drawer-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .history-drawer-header h3 {
    color: #1a1a2e;
}
body.theme-light .history-drawer-close {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .history-drawer-close:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.06);
}
body.theme-light .history-delete-all-btn {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .history-delete-all-btn:hover {
    color: #ef4444;
}

/* 历史项 */
body.theme-light .conv-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .conv-item.active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.15);
}
body.theme-light .conv-item-title {
    color: #1a1a2e;
}
body.theme-light .conv-item-time {
    color: rgba(0, 0, 0, 0.38);
}
body.theme-light .conv-item-delete {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .conv-item-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

body.theme-light .history-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .history-item.active {
    background: rgba(99, 102, 241, 0.06);
}
body.theme-light .history-item-title {
    color: #1a1a2e;
}
body.theme-light .history-item-time {
    color: rgba(0, 0, 0, 0.38);
}
body.theme-light .history-item-delete {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .history-item-delete:hover {
    color: #ef4444;
}

/* 历史面板 */
body.theme-light .history-panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}
body.theme-light .history-panel-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
}
body.theme-light .history-panel-close {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .history-panel-close:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.06);
}

/* ── P2: 模态框/弹窗 ── */
body.theme-light .modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}
body.theme-light .modal-content {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    color: #1a1a2e;
}
body.theme-light .close-modal {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .close-modal:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.08);
}

/* 设置弹窗 */
body.theme-light .settings-group {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01));
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02);
}
body.theme-light .setting-item {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .setting-input,
body.theme-light .setting-range {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .setting-input:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .setting-hint {
    color: rgba(0, 0, 0, 0.38);
}

/* 确认弹窗 */
body.theme-light .confirm-modal-content {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
}
body.theme-light .confirm-btn-cancel {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
body.theme-light .confirm-btn-cancel:hover {
    background: rgba(0, 0, 0, 0.08);
}
body.theme-light .confirm-btn-ok {
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: #fff;
}
body.theme-light .confirm-btn-ok:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
}

/* ── P2: 居中大弹窗 (公告等) ── */
body.theme-light .ms-modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}
body.theme-light .ms-modal {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
body.theme-light .ms-modal-header h3,
body.theme-light .ms-modal-title {
    color: #1a1a2e;
}
body.theme-light .ms-modal-close {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .ms-modal-close:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.08);
}

/* 联系客服弹窗 */
body.theme-light .ms-contact-modal {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
body.theme-light .ms-contact-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .ms-contact-header h3 {
    color: #1a1a2e;
}

/* ── P2: 接入模式选择弹窗 ── */
body.theme-light .mode-selector-overlay {
    background: rgba(0, 0, 0, 0.3);
}
body.theme-light .mode-selector-modal {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}
body.theme-light .ms-modal-left {
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .ms-left-desc {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .ms-side-card {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .ms-side-card.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
}
body.theme-light .ms-side-card-title {
    color: #1a1a2e;
}
body.theme-light .ms-side-card-desc {
    color: rgba(0, 0, 0, 0.45);
}
body.theme-light .ms-btn-confirm {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
}
body.theme-light .ms-btn-confirm:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}
body.theme-light .ms-btn-cancel {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ── P2: 图片选项/路由策略弹窗 ── */
body.theme-light .image-options-popup,
body.theme-light .route-strategy-popup {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
    color: #1a1a2e;
}
body.theme-light .image-options-popup .option-item,
body.theme-light .route-strategy-popup .option-item {
    color: #1a1a2e;
}
body.theme-light .image-options-popup .option-item:hover,
body.theme-light .route-strategy-popup .option-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .image-options-popup .option-item.active,
body.theme-light .route-strategy-popup .option-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
}

/* ── P2: Toast ── */
body.theme-light .toast {
    color: #1a1a2e;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
body.theme-light .toast.info {
    border-color: rgba(99, 102, 241, 0.25);
}

/* ── P2: 回到底部按钮 ── */
body.theme-light .scroll-bottom-btn {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
body.theme-light .scroll-bottom-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a1a2e;
}
body.theme-light .scroll-bottom-btn span {
    color: rgba(0, 0, 0, 0.6);
}

/* ── P2: 移动端遮罩 ── */
body.theme-light .sidebar-overlay {
    background: rgba(0, 0, 0, 0.2);
}

/* ── P2: 选中文字 ── */
body.theme-light ::selection {
    background: rgba(99, 102, 241, 0.15);
    color: #1a1a2e;
}

/* ── P2: 角色管理弹窗 ── */
body.theme-light .role-manager-backdrop,
body.theme-light .asset-selector-backdrop,
body.theme-light .asset-editor-backdrop {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
body.theme-light .role-manager-panel,
body.theme-light .asset-selector-panel,
body.theme-light .asset-editor-panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
}
body.theme-light .role-manager-header,
body.theme-light .asset-selector-header,
body.theme-light .asset-editor-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .role-manager-heading h3,
body.theme-light .asset-selector-heading h3,
body.theme-light .asset-editor-header h3 {
    color: #1a1a2e;
}
body.theme-light .role-manager-heading p,
body.theme-light .asset-selector-heading p,
body.theme-light .asset-editor-subtitle {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .role-manager-kicker,
body.theme-light .asset-selector-kicker,
body.theme-light .asset-editor-kicker {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .role-manager-close,
body.theme-light .asset-selector-close {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .role-manager-close:hover,
body.theme-light .asset-selector-close:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.08);
}
body.theme-light .role-manager-tabs,
body.theme-light .asset-selector-tabs {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .role-manager-tab,
body.theme-light .asset-selector-tab {
    color: rgba(0, 0, 0, 0.45);
}
body.theme-light .role-manager-tab.active,
body.theme-light .asset-selector-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}
body.theme-light .role-manager-current {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .role-manager-current-text {
    color: #1a1a2e;
}
body.theme-light .role-ghost-btn {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
body.theme-light .role-form-field span {
    color: rgba(0, 0, 0, 0.6);
}
body.theme-light .role-form-field input,
body.theme-light .role-form-field textarea {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .role-form-field input:focus,
body.theme-light .role-form-field textarea:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .role-primary-btn {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
}
body.theme-light .role-primary-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}
body.theme-light .role-secondary-btn {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
body.theme-light .role-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .role-card:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
}
body.theme-light .role-card.active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}
body.theme-light .role-card-name {
    color: #1a1a2e;
}
body.theme-light .role-card-desc {
    color: rgba(0, 0, 0, 0.5);
}

/* 资产选择器 */
body.theme-light .asset-selector-search input {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}
body.theme-light .asset-selector-search svg {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .asset-head-btn.primary {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
}
body.theme-light .asset-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .asset-card:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
}
body.theme-light .asset-card-name {
    color: #1a1a2e;
}
body.theme-light .asset-selector-summary {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .asset-selector-categories {
    color: rgba(0, 0, 0, 0.5);
}

/* ── P2: Frame Upload Panel ── */
body.theme-light .frame-upload-panel {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .frame-slot {
    border: 1px dashed rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .frame-slot:hover {
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .frame-slot-remove {
    background: #ef4444;
    color: #fff;
}

/* ── P2: 图片结果消息 ── */
body.theme-light .img-chip {
    background: rgba(248, 250, 252, 0.96);
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .img-chip:hover {
    background: #f1f5f9;
    border-color: rgba(79, 70, 229, 0.18);
}
body.theme-light .img-chip-label {
    color: #374151;
}
body.theme-light .img-result-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .img-result-card:hover {
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
body.theme-light .img-result-meta {
    color: rgba(0, 0, 0, 0.5);
}

/* ── P2: 工坊容器 ── */
body.theme-light .workshop-container {
    color: #1a1a2e;
}
body.theme-light .workshop-panel {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
/* ── 工坊浅色模式全面修复 ── */
body.theme-light .workshop-page-title { color: #1a1a2e; }
body.theme-light .workshop-page-subtitle { color: rgba(0,0,0,0.5); }
body.theme-light .workshop-page-back { color: rgba(0,0,0,0.45); }
body.theme-light .workshop-page-back:hover { color: rgba(0,0,0,0.8); background: rgba(0,0,0,0.05); }
body.theme-light .workshop-form { background: rgba(0,0,0,0.02); border: 1px solid rgba(0,0,0,0.06); }
body.theme-light .workshop-form-input,
body.theme-light .workshop-form-textarea,
body.theme-light .workshop-form-select { background: rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.1); color: #1a1a2e; }
body.theme-light .workshop-form-input:focus,
body.theme-light .workshop-form-textarea:focus,
body.theme-light .workshop-form-select:focus { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.02); }
body.theme-light .workshop-form-input::placeholder,
body.theme-light .workshop-form-textarea::placeholder { color: rgba(0,0,0,0.35); }
body.theme-light .workshop-form-select option { background: #fff; color: #1a1a2e; }
body.theme-light .workshop-form-label { color: rgba(0,0,0,0.6); }
/* ── 坊欢迎页修复 ── */
body.theme-light .workshop-welcome-title { color: #1a1a2e; }
body.theme-light .workshop-welcome-desc { color: rgba(0,0,0,0.5); }
body.theme-light .ws-welcome-card { background: rgba(0,0,0,0.025); border: 1px solid rgba(0,0,0,0.08); }
body.theme-light .ws-welcome-card:hover { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.12); }
body.theme-light .ws-welcome-card-icon { color: rgba(0,0,0,0.6); }
body.theme-light .ws-welcome-card-name { color: rgba(0,0,0,0.85); }
body.theme-light .ws-welcome-card-desc { color: rgba(0,0,0,0.5); }
body.theme-light .ws-welcome-card-badge { color: rgba(0,0,0,0.6); background: rgba(0,0,0,0.05); }
body.theme-light .ws-welcome-card-badge.hot { color: #fff; background: #ef4444; }
body.theme-light .ws-welcome-card-badge.new { color: #fff; background: #10b981; }
body.theme-light .ws-welcome-card-badge.soon { color: rgba(0,0,0,0.4); background: rgba(0,0,0,0.06); }

/* ── P2: up-link-highlight ── */
body.theme-light .up-link-highlight {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: #6366f1;
}
body.theme-light .up-link-highlight:hover {
    background: rgba(99, 102, 241, 0.12);
}

/* ── P3: 灯箱保持暗色（合理） ── */
/* lightbox 不覆盖，灯箱本身暗色背景在浅色模式下也合理 */

/* ── P3: 全局滚动条（浅色模式微调） ── */
body.theme-light .content-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}
body.theme-light .content-area::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ── P3: 移动端响应式补丁 ── */
@media (max-width: 768px) {
    body.theme-light .sidebar {
        background: rgba(255, 255, 255, 0.95);
    }
    body.theme-light .modal-content,
    body.theme-light .ms-modal,
    body.theme-light .mode-selector-modal {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* ── 浅色模式响应式：640px ── */
@media (max-width: 640px) {
    body.theme-light .mode-selector-modal {
        background: rgba(255, 255, 255, 0.98);
    }
    body.theme-light .ms-modal-left {
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }
}

/* ============================================================================
   浅色模式修复补丁 (v2) — 修复检查中发现的遗留问题
   ============================================================================ */

/* ── 修复1: 侧边栏模型图标 is-openai-white 在浅色模式下不可见 ── */
/* 原 filter: brightness(0) invert(1) 会把图标变白，在浅色背景上完全不可见 */
body.theme-light .model-icon-img.is-openai-white {
    filter: none;
}

/* ── 修复2: 模型分类标签栏背景几乎不可见 ── */
/* 原背景 rgba(255,255,255,0.03) 在浅色背景上几乎看不到 */
body.theme-light .model-tabs {
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── 修复3: 非激活标签文字对比度偏低 ── */
body.theme-light .tab-item {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .tab-item-workshop {
    color: rgba(0, 0, 0, 0.5);
}

/* ── 修复4: 模型搜索框背景对比度偏低 ── */
body.theme-light .model-search-input {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── 修复5: 模型描述文字对比度偏低 ── */
body.theme-light .model-desc {
    color: rgba(0, 0, 0, 0.5);
}

/* ── 修复6: 用户消息操作按钮背景未覆盖（选择器优先级不足）── */
/* 原 .message-actions.user-actions .msg-action-btn 优先级高于 body.theme-light .msg-action-btn */
body.theme-light .message-actions.user-actions .msg-action-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.45);
}
body.theme-light .message-actions.user-actions .msg-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a2e;
}

/* ── 修复7: 消息时间文字对比度偏低 ── */
body.theme-light .message-time {
    color: rgba(0, 0, 0, 0.4);
}

/* ── 修复8: 输入提示文字对比度偏低 ── */
body.theme-light .input-hint {
    color: rgba(0, 0, 0, 0.4);
}

/* ── 修复9: 资产入口按钮（角色管理按钮）在浅色模式下几乎不可见 ── */
/* 原 background: rgba(255,255,255,0.04), border: rgba(255,255,255,0.08) 在浅色背景上几乎看不到 */
body.theme-light .asset-entry-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .asset-entry-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a2e;
}
body.theme-light .asset-entry-btn.is-active {
    background-color: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

/* ── 修复10: 角色按钮图标颜色在浅色模式下几乎不可见 ── */
/* 原 color: rgba(232,228,255,0.92) 是浅紫色，在白色背景上几乎看不到 */
body.theme-light .role-entry-btn .asset-entry-icon {
    color: rgba(99, 102, 241, 0.85);
}
body.theme-light .role-entry-btn:hover .asset-entry-icon {
    color: #6366f1;
}
body.theme-light .role-entry-btn.is-active .asset-entry-icon {
    color: #6366f1;
}

/* ── 修复11: 功能菜单弹窗内按钮背景和边框几乎不可见 ── */
/* 原 background: rgba(255,255,255,0.02), border: rgba(255,255,255,0.05) 在浅色背景上几乎看不到 */
body.theme-light .action-grid-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
}
body.theme-light .action-grid-item:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ── 修复12: 发送按钮禁用态太淡 ── */
body.theme-light .send-btn:disabled {
    background-color: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.3);
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── 修复13: 侧边栏底部文字对比度偏低 ── */
body.theme-light .sidebar-footer {
    color: rgba(0, 0, 0, 0.45);
}

/* ── 修复14: 控制台按钮hover态背景 ── */
body.theme-light .console-btn {
    color: rgba(0, 0, 0, 0.55);
}

/* ── 修复15: 路由策略按钮文字颜色 ── */
body.theme-light .route-trigger-label {
    color: rgba(0, 0, 0, 0.65);
}
body.theme-light .toggle-tool .route-trigger-label {
    color: rgba(0, 0, 0, 0.65);
}

/* ── 修复16: 模型列表滚动条 ── */
body.theme-light .model-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

/* ── 修复17: 消息区滚动条 ── */
body.theme-light .messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
body.theme-light .messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.18);
}
body.theme-light .messages-container::-webkit-scrollbar-track {
    background: transparent;
}

/* ── 修复18: 代码块滚动条 ── */
body.theme-light .code-block pre::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
body.theme-light .code-block pre::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ── 修复19: 全局滚动条补丁 ── */
body.theme-light *::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
body.theme-light *::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.18);
}
body.theme-light *::-webkit-scrollbar-track {
    background: transparent;
}

/* ── 修复20: 输入框边框对比度 ── */
body.theme-light .chat-input-box {
    border: 1px solid rgba(0, 0, 0, 0.12);
}

/* ── 修复21: 工具栏按钮hover增强 ── */
body.theme-light .tool-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a2e;
}

/* ── 修复22: 上传按钮图标颜色 ── */
body.theme-light .upload-btn,
body.theme-light #uploadBtn {
    color: rgba(0, 0, 0, 0.55);
}
body.theme-light .upload-btn:hover,
body.theme-light #uploadBtn:hover {
    color: #1a1a2e;
}

/* ── 修复23: 模型badge文字颜色保持鲜艳 ── */
body.theme-light .model-badge.badge-hot {
    color: #ff5a5f;
}
body.theme-light .model-badge.badge-new {
    color: #10b981;
}

/* ── 修复24: cap-tag 浅色模式增强 ── */
body.theme-light .cap-tag {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── 修复25: 钱包用户卡片文字颜色 ── */
body.theme-light .wallet-user-card {
    color: rgba(0, 0, 0, 0.5);
}

/* ── 修复26: 充值徽章 ── */
body.theme-light .wallet-recharge-badge {
    background: #ff4d4f;
    color: #fff;
}

/* ── 修复27: 历史抽屉滚动条 ── */
body.theme-light .history-drawer::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

/* ── 修复28: 弹窗内滚动条 ── */
body.theme-light .modal-content::-webkit-scrollbar-thumb,
body.theme-light .ms-modal::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   浅色模式修复补丁 (v3) — 修复用户反馈的4个问题
   ============================================================================ */

/* ── 问题1: AI回复消息气泡背景是深色渐变 ── */
/* .message.assistant .message-bubble 有深色渐变背景 rgba(20,20,24,0.9)→rgba(10,10,12,0.86) */
body.theme-light .message.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
body.theme-light .message.assistant .message-body {
    background: none;
    border: none;
    box-shadow: none;
}

/* ── 问题2: 深度思考区域文字是白色（在浅色气泡内不可见）── */
body.theme-light .thinking-section {
    border-left: 2px solid rgba(99, 102, 241, 0.3);
    background: transparent;
}
body.theme-light .thinking-header:hover {
    background: rgba(99, 102, 241, 0.04);
}
body.theme-light .thinking-chip {
    color: #6366f1;
}
body.theme-light .thinking-status {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .thinking-toggle {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .thinking-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.55);
}
body.theme-light .thinking-content-inner {
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.6);
    border-left: 1px solid rgba(99, 102, 241, 0.15);
}
body.theme-light .thinking-body {
    color: rgba(0, 0, 0, 0.6);
}
body.theme-light .thinking-dots span {
    background: rgba(0, 0, 0, 0.35);
}

/* ── 问题3: 功能菜单弹窗增强可见度 ── */
/* 弹窗背景已经是对的，但按钮的::before伪元素在hover时有深色渐变 */
body.theme-light .action-grid-item::before {
    opacity: 0 !important;
}
body.theme-light .action-grid-item:hover::before {
    opacity: 0 !important;
}
/* 弹窗内按钮hover时的发光效果 */
body.theme-light .action-grid-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* ── 问题4: 综合最优渠道弹窗白色文字 ── */
/* 大量文字使用 color: #fff 或 rgba(255,255,255,...) 在白色背景上完全不可见 */

/* 弹窗标题 */
body.theme-light .route-popup-title-main {
    color: #1a1a2e;
}

/* 估算区域内的白色文字（内联样式 color:#fff 需要 !important） */
body.theme-light .route-popup-estimate span {
    color: #1a1a2e !important;
}
body.theme-light .route-popup-estimate span:first-child {
    color: #14b8a6 !important;
}

/* 选项按钮 */
body.theme-light .route-popup-option {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .route-popup-option:hover {
    border-color: rgba(20, 184, 166, 0.3);
    background: rgba(20, 184, 166, 0.05);
}
body.theme-light .route-popup-option.active {
    border-color: rgba(20, 184, 166, 0.4);
    background: rgba(20, 184, 166, 0.08);
}
body.theme-light .route-popup-option-title {
    color: rgba(0, 0, 0, 0.85);
}
body.theme-light .route-popup-option-content {
    color: #1a1a2e;
}

/* 分区提示文字 */
body.theme-light .route-popup-section-hint {
    color: rgba(0, 0, 0, 0.4);
}

/* 分割线 */
body.theme-light .route-popup-divider::before,
body.theme-light .route-popup-divider::after {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .route-popup-divider span {
    color: rgba(0, 0, 0, 0.4);
}

/* 渠道列表 */
body.theme-light .route-popup-channel {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .route-popup-channel:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(20, 184, 166, 0.3);
}
body.theme-light .route-popup-channel.active {
    background: rgba(20, 184, 166, 0.08);
    border-color: rgba(20, 184, 166, 0.4);
}
body.theme-light .route-popup-channel-title {
    color: #1a1a2e;
}
body.theme-light .route-popup-channel-top,
body.theme-light .route-popup-channel-bottom {
    color: #1a1a2e;
}

/* 渠道列表滚动条 */
body.theme-light .route-popup-channel-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
body.theme-light .route-popup-channel-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.18);
}

/* ── 额外修复: 搜索指示器在浅色气泡内 ── */
body.theme-light .search-indicator {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: #059669;
}

/* ── 额外修复: 代码块在浅色气泡内 ── */
body.theme-light .code-block {
    background: #f6f8fa;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
body.theme-light .code-header {
    background: rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .code-lang {
    color: #6a737d;
}
body.theme-light .code-copy {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .code-copy:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.08);
}

/* ── 额外修复: 消息内链表/引用等 ── */
body.theme-light .message-content blockquote {
    border-left: 2px solid rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.04);
    color: rgba(0, 0, 0, 0.65);
}
body.theme-light .message-content a {
    color: #6366f1;
}
body.theme-light .message-content strong {
    color: #1a1a2e;
}
body.theme-light .message-content h2,
body.theme-light .message-content h3,
body.theme-light .message-content h4 {
    color: #1a1a2e;
}
body.theme-light .message-content .inline-code {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: #4f46e5;
}

/* ── 额外修复: 表格在浅色气泡内 ── */
body.theme-light .table-wrap {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
}
body.theme-light .table-wrap th {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
}
body.theme-light .table-wrap td {
    color: rgba(0, 0, 0, 0.7);
}
body.theme-light .table-wrap th,
body.theme-light .table-wrap td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── 额外修复: 消息操作按钮在浅色气泡内 ── */
body.theme-light .msg-action-btn {
    color: rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .msg-action-btn:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.08);
}

/* ── 额外修复: 消息计费在浅色气泡内 ── */
body.theme-light .message-billing,
body.theme-light .message-billing .billing-label,
body.theme-light .message-billing .billing-value,
body.theme-light .message-billing .billing-cost {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .message-billing .billing-currency {
    color: #d97706;
}

/* ── 额外修复: 消息文件附件 ── */
body.theme-light .message-file {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .message-file-icon {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}
body.theme-light .message-file-name {
    color: #1a1a2e;
}

/* ── 额外修复: 消息图片 ── */
body.theme-light .message-img {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── 额外修复: 展开全部代码按钮 ── */
body.theme-light .code-expand-btn {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
}
body.theme-light .code-expand-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.25);
}

/* ============================================================================
   浅色模式修复补丁 (v4) — 修复右侧模型信息面板白色文字/图标问题
   ============================================================================ */

/* ── 模型信息面板：模型名称 ── */
/* 原 color: rgba(255, 255, 255, 0.95) 在浅色背景上完全不可见 */
body.theme-light .model-info-name {
    color: #1a1a2e !important;
}

/* ── 模型信息面板：模型描述 ── */
/* 原 color: rgba(255, 255, 255, 0.5) 在浅色背景上完全不可见 */
body.theme-light .model-info-desc {
    color: rgba(0, 0, 0, 0.55) !important;
}

/* ── 模型信息面板：能力标签（识图、工具等）── */
/* 原 background/border/color 全是白色系 + !important，在浅色背景上完全不可见 */
body.theme-light .model-info-cap {
    background: rgba(99, 102, 241, 0.08) !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
    color: #6366f1 !important;
}

/* ── 模型信息面板：图标阴影 ── */
/* 原 filter: drop-shadow(0 4px 16px rgba(255,255,255,0.15)) 白色阴影在浅色背景上无效果 */
body.theme-light .model-info-icon {
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.1));
}

/* ── 模型信息面板：is-openai-white 图标 ── */
/* 原 filter: brightness(0) invert(1) 把图标变成纯白，在浅色背景上完全不可见 */
body.theme-light .model-info-icon.is-openai-white {
    filter: none;
}

/* ============================================================================
   浅色模式修复补丁 (v5) — 修复角色管理/资产库/上传素材弹窗的白色文字和边框
   ============================================================================ */

/* ── 资产库面板：空状态 ── */
/* 原 color/border/background 全是白色系，在浅色背景上完全不可见 */
body.theme-light .asset-selector-empty {
    color: rgba(0, 0, 0, 0.5);
    border: 1px dashed rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .asset-selector-empty-icon {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .asset-selector-empty-icon svg {
    color: rgba(0, 0, 0, 0.35);
}

/* ── 资产库面板：搜索框 ── */
/* 原 border/background/color 全是白色系 */
body.theme-light .asset-selector-search {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.5);
}

/* ── 资产库面板：关闭按钮边框 ── */
body.theme-light .asset-selector-close {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── 资产库面板：标签按钮边框和背景 ── */
body.theme-light .asset-selector-tab {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
}
body.theme-light .asset-selector-tab.active {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.08);
}
body.theme-light .asset-selector-tab.is-category {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
}
body.theme-light .asset-selector-tab.is-category.active {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.08);
}

/* ── 资产库面板：非主要按钮（取消等）── */
/* 原 color/border/background 全是白色系 */
body.theme-light .asset-head-btn {
    color: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .asset-head-btn:hover {
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.06);
}

/* ── 上传素材弹窗：预览区 ── */
body.theme-light .asset-editor-preview {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .asset-editor-preview-meta {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #fff;
}

/* ── 上传素材弹窗：选择图片区域 ── */
body.theme-light .asset-editor-picker {
    border: 1px dashed rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.02);
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .asset-editor-picker-btn {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
}
body.theme-light .asset-editor-picker-btn:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
    color: #4f46e5;
}

/* ── 上传素材弹窗：表单字段 ── */
body.theme-light .asset-editor-field > span {
    color: rgba(0, 0, 0, 0.75);
}
body.theme-light .asset-editor-field input,
body.theme-light .asset-editor-field textarea {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
    color: #1a1a2e;
}
body.theme-light .asset-editor-field input:focus,
body.theme-light .asset-editor-field textarea:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(0, 0, 0, 0.02);
}

/* ── 上传素材弹窗：分类标签 ── */
body.theme-light .asset-editor-category-chip {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.6);
}
body.theme-light .asset-editor-category-chip.active,
body.theme-light .asset-editor-category-chip:hover {
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.1);
}

/* ── 上传素材弹窗：底部操作栏 ── */
body.theme-light .asset-editor-actions {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── 上传素材弹窗：头部 ── */
body.theme-light .asset-editor-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── 角色管理：标签按钮边框和背景 ── */
body.theme-light .role-manager-tab {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
}
body.theme-light .role-manager-tab.active {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.08);
}

/* ── 角色管理：关闭按钮边框 ── */
body.theme-light .role-manager-close {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── 角色管理：角色卡片标题 ── */
/* 原 color: #fff 在浅色背景上不可见 */
body.theme-light .role-card-title {
    color: #1a1a2e;
}

/* ── 角色管理：角色卡片提示词 ── */
/* 原 color/border/background 全是白色系 */
body.theme-light .role-card-prompt {
    background: rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.55);
}

/* ── 角色管理：角色卡片操作按钮 ── */
body.theme-light .role-card-actions button {
    color: rgba(0, 0, 0, 0.5);
}

/* ── 角色管理：secondary/ghost 按钮边框补充 ── */
body.theme-light .role-secondary-btn {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ── v6: Logo 图片 mix-blend-mode 修复 ── */
/* Logo图片是黑底白字：先用 filter:invert(1) 反转为白底黑字，再用 multiply 让白底融入白色侧边栏 */
body.theme-light .logo-img,
body.theme-light .welcome-logo-img {
    mix-blend-mode: multiply;
    filter: invert(1);
}

/* ── v6: Logo 文字渐变修复 ── */
/* 原 gradient(#555→#fff) 在浅色背景上几乎不可见，改为深色渐变 */
body.theme-light .logo-text {
    background: linear-gradient(to right, #999 0%, #1a1a2e 45%, #1a1a2e 55%, #999 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── v6: 上传参考图预览卡片修复 ── */
/* 原 background: rgba(14,16,22,0.82) + border: rgba(255,255,255,0.24) 在浅色模式下显示为黑框 */
body.theme-light .preview-item {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.8)),
        rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
body.theme-light .preview-item:hover {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* 预览卡片浮动文件名 */
body.theme-light .preview-floating-name {
    background: rgba(255, 255, 255, 0.85);
    color: rgba(0, 0, 0, 0.65);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* 预览卡片删除按钮 */
body.theme-light .preview-remove {
    background: rgba(255, 255, 255, 0.92);
    color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
body.theme-light .preview-remove:hover {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* 预览卡片文件类型图标背景 */
body.theme-light .preview-item-file {
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.01)),
        rgba(248, 250, 252, 0.9);
}
body.theme-light .preview-item .file-icon {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.01));
    color: #6366f1;
}

/* 更多图片遮罩 */
body.theme-light .more-imgs-overlay {
    background: rgba(255, 255, 255, 0.7);
    color: #1a1a2e;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* ── v7: Kimi K3 白色线条图标浅色模式修复 ── */
/* Kimi K3 图标是白色线条（非黑色），浅色模式下不可见 */
/* 用 invert(1) 将白色线条反转为黑色，和 GPT 图标在浅色模式下的效果一致 */
/* 通过 src 中的唯一标识 a4d56649 精确匹配，不影响其他图标 */
body.theme-light .model-icon-img[src*="a4d56649"],
body.theme-light .model-selector-icon[src*="a4d56649"],
body.theme-light .model-info-icon[src*="a4d56649"],
body.theme-light .msg-avatar-img[src*="a4d56649"] {
    filter: invert(1) !important;
}

/* ============================================================================
   浅色模式补丁 (v8) — 修复P0问题：加载占位符/API Key/充值/签到弹窗
   ============================================================================ */

/* ── P0-1: 图片/视频加载占位符浅色模式修复 ── */
/* 原硬编码深色背景 linear-gradient(135deg, #18181b 0%, #0f0f12 100%) !important */
body.theme-light .image-loading-placeholder,
body.theme-light .image-loading-tile {
    background: linear-gradient(135deg, #f0f1f3 0%, #e8e9eb 100%) !important;
}
/* 加载完成后保持透明（原规则已存在，这里确保浅色模式下也生效） */
body.theme-light .image-loading-placeholder.image-loaded,
body.theme-light .image-loading-placeholder.image-revealing,
body.theme-light .image-loading-tile.image-loaded,
body.theme-light .image-loading-tile.image-revealing {
    background: transparent !important;
}

/* 视频加载占位符 */
body.theme-light .video-grid-item.video-loading-placeholder {
    background: #f0f1f3;
}

/* 视频错误占位符 */
body.theme-light .video-error-item {
    background: #f0f1f3;
    color: rgba(0, 0, 0, 0.3);
}

/* 视频结果组卡片 */
body.theme-light .video-result-group-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .video-result-group-card .img-result-meta,
body.theme-light .video-result-group-card .video-result-meta {
    color: rgba(0, 0, 0, 0.5);
}

/* 图片结果组卡片 */
body.theme-light .image-result-group-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .image-result-group-card .img-result-meta {
    color: rgba(0, 0, 0, 0.5);
}

/* ── P0-2: API Key 列表弹窗浅色模式修复 ── */
/* 原 .up-key-item 等组件全部使用 rgba(255,255,255,...) 硬编码，在浅色背景上不可见 */
body.theme-light .up-key-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .up-key-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .up-key-item.active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}
body.theme-light .up-key-name {
    color: #1a1a2e;
}
body.theme-light .up-key-meta {
    color: rgba(0, 0, 0, 0.45);
}
body.theme-light .up-key-tag {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.15);
}
body.theme-light .up-btn-ghost {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .up-btn-ghost:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
}
body.theme-light .up-btn-icon {
    color: rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .up-btn-icon:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}
body.theme-light .up-empty-state {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .up-empty-state p {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .up-empty-icon {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .up-empty-icon svg {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .up-status-dot.active {
    background: #10b981;
}
body.theme-light .up-link-highlight {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: #6366f1;
}
body.theme-light .up-link-highlight:hover {
    background: rgba(99, 102, 241, 0.12);
}

/* API Key 列表弹窗内的表单输入框 */
body.theme-light .up-key-list-modal input,
body.theme-light .up-key-list-modal textarea {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .up-key-list-modal input:focus,
body.theme-light .up-key-list-modal textarea:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .up-key-list-modal input::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

/* ============================================================================
   浅色模式补丁 (v9) — 修复功能菜单内各弹窗的白色文字/背景遗漏
   ============================================================================ */

/* ── 联系客服弹窗：内部元素 ── */
body.theme-light .contact-avatar {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
body.theme-light .contact-name { color: #1a1a2e; }
body.theme-light .contact-subtitle { color: rgba(0, 0, 0, 0.5); }
body.theme-light .contact-qr-hint { color: rgba(0, 0, 0, 0.55); }
body.theme-light .contact-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .contact-card:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .info-label { color: rgba(0, 0, 0, 0.5); }
body.theme-light .info-value { color: #1a1a2e; }
body.theme-light .ms-contact-modal::before {
    background: radial-gradient(circle at center top, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}
body.theme-light .ms-contact-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── 系统公告弹窗：公告卡片 ── */
body.theme-light .ms-notice-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .ms-notice-card:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}
body.theme-light .ms-notice-card::before {
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.04), transparent);
}
body.theme-light .ms-notice-title { color: #1a1a2e; }
body.theme-light .ms-notice-content { color: rgba(0, 0, 0, 0.7); }
body.theme-light .ms-notice-content img {
    background-color: rgba(0, 0, 0, 0.03);
}
body.theme-light .ms-notice-date { color: rgba(0, 0, 0, 0.4); }
body.theme-light .ms-notice-badge.type-notice {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.12);
}
body.theme-light .ms-empty-state { color: rgba(0, 0, 0, 0.4); }

/* ── 意见反馈弹窗 ── */
body.theme-light .ms-feedback-overlay { background: rgba(0, 0, 0, 0.25); }
body.theme-light .ms-feedback-modal {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
body.theme-light .ms-feedback-modal::before {
    background: radial-gradient(circle at center top, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}
body.theme-light .ms-feedback-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .ms-feedback-header h3 { color: #1a1a2e; }
body.theme-light .ms-feedback-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); }
body.theme-light .ms-feedback-modal .form-group label { color: rgba(0, 0, 0, 0.85); }
body.theme-light .ms-feedback-modal .form-group label .optional { color: rgba(0, 0, 0, 0.4); }
body.theme-light .ms-feedback-modal .ms-input {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .ms-feedback-modal .ms-input:focus {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
body.theme-light .ms-feedback-modal .ms-input::placeholder { color: rgba(0, 0, 0, 0.3); }
body.theme-light .ms-feedback-modal select.ms-input {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(0,0,0,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
body.theme-light .ms-feedback-modal select.ms-input option { background: #fff; color: #1a1a2e; }
body.theme-light .ms-feedback-modal .feedback-submit-btn {
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

/* ── 侧滑抽屉（意见反馈等）── */
body.theme-light .ms-drawer {
    background: rgba(255, 255, 255, 0.96);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: -24px 0 80px rgba(0, 0, 0, 0.15);
}

/* ── 功能菜单按钮 hover 规则已废弃 ── */
/* 新菜单使用 .action-menu-item 类选择器，旧 ID 选择器规则已删除避免优先级冲突 */

/* ── 偏好设置弹窗：setting-input 聚焦态修复 ── */
body.theme-light .setting-input:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
}
body.theme-light .setting-item {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── 公告弹窗内部滚动条 ── */
body.theme-light .ms-modal::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); }
body.theme-light .ms-feedback-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); }

/* ============================================================================
   浅色模式补丁 (v10) — 接入模式弹窗/偏好设置标题/公告铃铛/资产库卡片/工坊作品
   ============================================================================ */

/* ── 接入模式弹窗：右侧详情面板全部元素 ── */
body.theme-light .ms-left-title { color: #1a1a2e; }
body.theme-light .ms-side-card > p { color: rgba(0, 0, 0, 0.5); }
body.theme-light .ms-side-card h3 { color: #1a1a2e; }
body.theme-light .ms-side-card:hover {
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .ms-side-card.selected {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.06);
}
body.theme-light .ms-side-check {
    border-color: rgba(0, 0, 0, 0.15);
}
body.theme-light .ms-side-card.selected .ms-side-check {
    border-color: #6366f1;
    background: #6366f1;
}
body.theme-light .ms-side-card.selected .ms-side-check::after {
    background: #fff;
}
body.theme-light .ms-modal-right::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
body.theme-light .ms-detail-header h3 { color: #1a1a2e; }
body.theme-light .ms-detail-desc { color: rgba(0, 0, 0, 0.55); }
body.theme-light .ms-detail-features li { color: rgba(0, 0, 0, 0.55); }
body.theme-light .ms-detail-features li svg { color: #10b981; }
body.theme-light .ms-api-config {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .ms-config-head h4 { color: #1a1a2e; }
body.theme-light .ms-get-key-link { color: #6366f1; }
body.theme-light .ms-key-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .ms-key-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
body.theme-light .ms-key-item.active {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}
body.theme-light .ms-key-dot.inactive {
    background: rgba(0, 0, 0, 0.2);
}
body.theme-light .ms-key-name { color: #1a1a2e; }
body.theme-light .ms-key-name .ms-active-badge {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}
body.theme-light .ms-key-url { color: rgba(0, 0, 0, 0.35); }
body.theme-light .ms-key-action-btn {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .ms-key-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}
body.theme-light .ms-key-switch-btn {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .ms-key-switch-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}
body.theme-light .ms-key-empty { color: rgba(0, 0, 0, 0.3); }
body.theme-light .ms-add-key-form {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .ms-form-field label { color: rgba(0, 0, 0, 0.55); }
body.theme-light .ms-form-input {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .ms-form-input::placeholder { color: rgba(0, 0, 0, 0.3); }
body.theme-light .ms-form-input:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
}
body.theme-light .ms-toggle-visible { color: rgba(0, 0, 0, 0.3); }
body.theme-light .ms-toggle-visible:hover { color: #1a1a2e; }
body.theme-light .ms-btn-add-key {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .ms-btn-add-key:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
}
body.theme-light .ms-tag-recommend {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
}
body.theme-light .ms-tag-advanced {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

/* ── 偏好设置弹窗：标题渐变修复 ── */
/* 原 background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%) + background-clip: text 在浅色背景上不可见 */
body.theme-light .settings-modern-modal .settings-header-text h3 {
    background: linear-gradient(135deg, #1a1a2e 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
body.theme-light .settings-modern-modal .close-modal {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .settings-modern-modal .close-modal:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}

/* ── 系统公告弹窗：铃铛图标颜色 + 标题渐变修复 ── */
/* 原铃铛 color: #fff 在浅色背景上不可见 */
body.theme-light .ms-modal-icon {
    color: #f59e0b;
    opacity: 1;
}
/* 原标题 background: linear-gradient(135deg, #fff 20%, #888 40%, #fff 60%, #888 80%) 在浅色背景上不可见 */
body.theme-light .ms-modal-header h3 {
    background: linear-gradient(135deg, #1a1a2e 20%, #6366f1 40%, #1a1a2e 60%, #6366f1 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
body.theme-light .ms-modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .ms-modal-close {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .ms-modal-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}
body.theme-light .ms-modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

/* ── 资产库卡片：内部元素浅色覆盖 ── */
body.theme-light .asset-card-thumb-wrap {
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .asset-card-thumb-empty {
    color: rgba(0, 0, 0, 0.35);
}
body.theme-light .asset-kind-chip.is-inline {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.7);
    border-color: rgba(0, 0, 0, 0.08);
}
body.theme-light .asset-card-model,
body.theme-light .asset-time,
body.theme-light .asset-card-meta {
    color: rgba(0, 0, 0, 0.48);
}
body.theme-light .asset-card-title {
    color: #1a1a2e;
}
body.theme-light .asset-card-desc {
    color: rgba(0, 0, 0, 0.55);
}
body.theme-light .asset-card-actions .asset-action-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.7);
}
body.theme-light .asset-card-actions .asset-action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a2e;
}
body.theme-light .asset-card-actions .asset-action-btn.primary {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}
body.theme-light .asset-card-actions .asset-action-btn.primary:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}
body.theme-light .asset-card-prompt {
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .asset-prompt-label {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .asset-prompt-text {
    color: rgba(0, 0, 0, 0.7);
}

/* ── 工坊/作品页：表单元素浅色覆盖 ── */
body.theme-light .workshop-form-select,
body.theme-light .workshop-form-input {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
body.theme-light .workshop-form-select:focus,
body.theme-light .workshop-form-input:focus {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
}
body.theme-light .workshop-form-label {
    color: rgba(0, 0, 0, 0.6);
}
body.theme-light .workshop-result-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light .workshop-result-title {
    color: #1a1a2e;
}
body.theme-light .workshop-result-desc {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .workshop-empty {
    color: rgba(0, 0, 0, 0.4);
}

/* ── 接入模式弹窗底部按钮 ── */
body.theme-light .ms-modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
}

/* ── 资产库卡片：遗漏元素修复 ── */
body.theme-light .asset-card {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.6);
}
body.theme-light .asset-card:hover {
    border-color: rgba(0, 0, 0, 0.14);
    background: rgba(255, 255, 255, 0.8);
}
body.theme-light .asset-action-btn.is-disabled,
body.theme-light .asset-action-btn.is-disabled:hover {
    color: rgba(0, 0, 0, 0.3);
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .asset-action-btn.asset-action-danger {
    color: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.04);
}
body.theme-light .asset-action-btn.asset-action-danger:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}
body.theme-light .asset-card-upload .asset-card-thumb-wrap::after {
    background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.08) 100%);
}
body.theme-light .asset-card-content,
body.theme-light .asset-card-chat {
    color: #1a1a2e;
}
body.theme-light .asset-card-head {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
/* 资产库搜索框修复 */
body.theme-light .asset-selector-search {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: none;
}
body.theme-light .asset-selector-search:focus-within {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}
body.theme-light .asset-selector-search input {
    color: #1a1a2e;
}
body.theme-light .asset-selector-search input::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

/* ── 加载动画：文案和背景浅色模式修复 ── */
/* 原背景 #f0f1f3 太白，改为带渐变色的浅灰 */
body.theme-light .image-loading-placeholder,
body.theme-light .image-loading-tile {
    background: linear-gradient(135deg, #e8e9f0 0%, #d8d9e0 100%) !important;
}
body.theme-light .video-loading-placeholder {
    background: linear-gradient(135deg, #e8e9f0 0%, #d8d9e0 100%);
}
body.theme-light .video-grid-item.video-loading-placeholder {
    background: linear-gradient(135deg, #e8e9f0 0%, #d8d9e0 100%);
}
body.theme-light .video-error-item {
    background: #e8e9f0;
    color: rgba(0, 0, 0, 0.3);
}
/* 加载动画文案：原 color: rgba(255,255,255,0.5) 白色不可见 */
body.theme-light .img-loader-status {
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .vid-loader-status {
    color: rgba(0, 0, 0, 0.5);
}
/* 加载动画径向光晕 */
body.theme-light .image-loading-placeholder::before,
body.theme-light .video-loading-placeholder::before {
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
}
/* 视频加载遮罩 */
body.theme-light .video-loading-overlay {
    background: rgba(232, 233, 240, 0.8);
}
body.theme-light .video-loading-overlay .video-loading-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #6366f1;
}

/* ── 历史会话：会话框基础背景修复 ── */
/* 原基础态无背景/边框，浅色模式白色抽屉上看不到会话框 */
body.theme-light .conv-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .conv-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}
body.theme-light .conv-item.active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.15);
    border-left: 2px solid #6366f1;
}
body.theme-light .conv-item.active .conv-item-title {
    color: #6366f1;
}
body.theme-light .conv-item.active .conv-item-icon {
    color: #6366f1;
}

body.theme-light .history-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .history-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}
body.theme-light .history-item.active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.15);
}
body.theme-light .history-item.active .history-item-title {
    color: #6366f1;
}

/* ── 新功能菜单：浅色模式覆盖 ── */
body.theme-light .action-menu-item {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
body.theme-light .action-menu-item::before {
    background: linear-gradient(135deg, rgba(0,0,0,0.06), rgba(0,0,0,0.02));
}
body.theme-light .action-menu-item:hover {
    background: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
body.theme-light .action-menu-item .menu-name {
    color: #1a1a2e;
}
body.theme-light .action-menu-item .menu-desc {
    color: rgba(0, 0, 0, 0.45);
}
/* 浅色模式：所有图标改为实心渐变底+白色图标 */
body.theme-light .action-menu-item .icon-blue    { background: linear-gradient(135deg, #3b82f6, #60a5fa); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,0.25); }
/* 浅色模式 hover：图标增强发光 */
body.theme-light .action-menu-item.item-blue:hover .menu-icon    { box-shadow: 0 0 24px rgba(59,130,246,0.6), 0 4px 16px rgba(59,130,246,0.2); }
body.theme-light .action-menu-item.item-indigo:hover .menu-icon   { box-shadow: 0 0 24px rgba(99,102,241,0.6), 0 4px 16px rgba(99,102,241,0.2); }
body.theme-light .action-menu-item.item-amber:hover .menu-icon    { box-shadow: 0 0 24px rgba(245,158,11,0.6), 0 4px 16px rgba(245,158,11,0.2); }
body.theme-light .action-menu-item.item-emerald:hover .menu-icon { box-shadow: 0 0 24px rgba(16,185,129,0.6), 0 4px 16px rgba(16,185,129,0.2); }
body.theme-light .action-menu-item.item-cyan:hover .menu-icon    { box-shadow: 0 0 24px rgba(6,182,212,0.6), 0 4px 16px rgba(6,182,212,0.2); }
body.theme-light .action-menu-item.item-rose:hover .menu-icon    { box-shadow: 0 0 24px rgba(244,63,94,0.6), 0 4px 16px rgba(244,63,94,0.2); }
body.theme-light .action-menu-item.item-violet:hover .menu-icon   { box-shadow: 0 0 24px rgba(139,92,246,0.6), 0 4px 16px rgba(139,92,246,0.2); }
body.theme-light .action-menu-item .icon-indigo   { background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,0.25); }
body.theme-light .action-menu-item .icon-amber    { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; box-shadow: 0 4px 12px rgba(245,158,11,0.25); }
body.theme-light .action-menu-item .icon-emerald { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,0.25); }
body.theme-light .action-menu-item .icon-cyan    { background: linear-gradient(135deg, #06b6d4, #22d3ee); color: #fff; box-shadow: 0 4px 12px rgba(6,182,212,0.25); }
body.theme-light .action-menu-item .icon-rose    { background: linear-gradient(135deg, #f43f5e, #fb7185); color: #fff; box-shadow: 0 4px 12px rgba(244,63,94,0.25); }
body.theme-light .action-menu-item .icon-violet   { background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: #fff; box-shadow: 0 4px 12px rgba(139,92,246,0.25); }
/* hover时名称变色（浅色模式深色调） */
body.theme-light .action-menu-item.item-blue:hover .menu-name    { color: #3b82f6; }
body.theme-light .action-menu-item.item-indigo:hover .menu-name   { color: #6366f1; }
body.theme-light .action-menu-item.item-amber:hover .menu-name    { color: #b45309; }
body.theme-light .action-menu-item.item-emerald:hover .menu-name { color: #047857; }
body.theme-light .action-menu-item.item-cyan:hover .menu-name    { color: #0e7490; }
body.theme-light .action-menu-item.item-rose:hover .menu-name    { color: #be123c; }
body.theme-light .action-menu-item.item-violet:hover .menu-name   { color: #6d28d9; }

/* ── 浅色模式：图标默认透明，hover时实心渐变发光 ── */
body.theme-light .action-menu-item .icon-blue    { background: rgba(59,130,246,0.1);  color: #3b82f6;  box-shadow: none; }
body.theme-light .action-menu-item .icon-indigo   { background: rgba(99,102,241,0.1); color: #6366f1; box-shadow: none; }
body.theme-light .action-menu-item .icon-amber    { background: rgba(245,158,11,0.1); color: #f59e0b; box-shadow: none; }
body.theme-light .action-menu-item .icon-emerald { background: rgba(16,185,129,0.1); color: #10b981; box-shadow: none; }
body.theme-light .action-menu-item .icon-cyan    { background: rgba(6,182,212,0.1);  color: #06b6d4; box-shadow: none; }
body.theme-light .action-menu-item .icon-rose    { background: rgba(244,63,94,0.1);  color: #f43f5e; box-shadow: none; }
body.theme-light .action-menu-item .icon-violet   { background: rgba(139,92,246,0.1); color: #8b5cf6; box-shadow: none; }
body.theme-light .action-menu-item:hover .icon-blue    { background: linear-gradient(135deg, #3b82f6, #60a5fa); color: #fff; }
body.theme-light .action-menu-item:hover .icon-indigo   { background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; }
body.theme-light .action-menu-item:hover .icon-amber    { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
body.theme-light .action-menu-item:hover .icon-emerald { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; }
body.theme-light .action-menu-item:hover .icon-cyan    { background: linear-gradient(135deg, #06b6d4, #22d3ee); color: #fff; }
body.theme-light .action-menu-item:hover .icon-rose    { background: linear-gradient(135deg, #f43f5e, #fb7185); color: #fff; }
body.theme-light .action-menu-item:hover .icon-violet   { background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: #fff; }

/* ── 浅色模式：所有按钮边框统一实心 linear-gradient ── */
body.theme-light #modeSelectorEntry::before,
body.theme-light #settingsBtn::before,
body.theme-light #noticeBtn::before,
body.theme-light #worksBtn::before,
body.theme-light #assetHistoryBtn::before,
body.theme-light #contactBtn::before,
body.theme-light #checkinTaskBtn::before,
body.theme-light #themeToggleBtn::before {
    background: linear-gradient(135deg, rgba(0,0,0,0.06), rgba(0,0,0,0.02));
}
body.theme-light #modeSelectorEntry:hover::before    { background: linear-gradient(135deg, #3b82f6, #60a5fa); opacity: 1; }
body.theme-light #settingsBtn:hover::before         { background: linear-gradient(135deg, #6366f1, #818cf8); opacity: 1; }
body.theme-light #noticeBtn:hover::before           { background: linear-gradient(135deg, #f59e0b, #fbbf24); opacity: 1; }
body.theme-light #worksBtn:hover::before            { background: linear-gradient(135deg, #10b981, #34d399); opacity: 1; }
body.theme-light #assetHistoryBtn:hover::before    { background: linear-gradient(135deg, #06b6d4, #22d3ee); opacity: 1; }
body.theme-light #contactBtn:hover::before         { background: linear-gradient(135deg, #f43f5e, #fb7185); opacity: 1; }
body.theme-light #checkinTaskBtn:hover::before     { background: linear-gradient(135deg, #f59e0b, #fbbf24); opacity: 1; }
body.theme-light #themeToggleBtn:hover::before     { background: linear-gradient(135deg, #8b5cf6, #a78bfa); opacity: 1; }

/* ============================================================================
   浅色模式：确认弹窗（删除资产/角色等）内联样式覆盖
   这些元素在 HTML 中有内联 style，必须用 !important 才能覆盖
   ============================================================================ */

body.theme-light #confirmModal {
    background: rgba(0, 0, 0, 0.3) !important;
}

body.theme-light #confirmTitle {
    color: #1a1a2e !important;
    -webkit-text-fill-color: #1a1a2e !important;
}

body.theme-light #confirmMessage {
    color: rgba(0, 0, 0, 0.6) !important;
}

body.theme-light #confirmCancelBtn {
    color: #1a1a2e !important;
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

body.theme-light #confirmCancelBtn:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

body.theme-light #confirmOkBtn {
    color: #fff !important;
    background: #6366f1 !important;
    border-color: #6366f1 !important;
}

body.theme-light #confirmOkBtn:hover {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
}

body.theme-light #confirmIcon {
    color: #6366f1 !important;
}

/* ============================================================================
   浅色模式覆盖结束
   ============================================================================ */

/* ============================================================================
   工坊开发中占位页样式
   ============================================================================ */

.ws-coming-soon-sidebar {
    padding: 24px 12px;
    text-align: center;
}
.ws-coming-soon-sidebar-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.3;
}
.ws-coming-soon-sidebar-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin: 0;
}

.ws-coming-soon-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
    padding: 20px;
}
.ws-coming-soon-main-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.5;
}
.ws-coming-soon-main-title {
    font-size: 22px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 8px;
}
.ws-coming-soon-main-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    max-width: 400px;
    line-height: 1.6;
    margin: 0;
}

/* 浅色模式：工坊开发中占位页 */
body.theme-light .ws-coming-soon-sidebar-text {
    color: rgba(0, 0, 0, 0.4);
}
body.theme-light .ws-coming-soon-main-title {
    color: #1a1a2e;
}
body.theme-light .ws-coming-soon-main-desc {
    color: rgba(0, 0, 0, 0.5);
}

/* 浅色模式：搜索框 placeholder */
body.theme-light .model-search-input::placeholder {
    color: rgba(0, 0, 0, 0.35) !important;
}

/* ============================================================================
   图片存储设置页样式
   ============================================================================ */
.local-save-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.local-save-path { flex: 1; min-width: 120px; padding: 10px 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; font-size: 13px; color: rgba(255,255,255,0.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-save-path.has-folder { color: #34d399; border-color: rgba(52,211,153,0.25); }
.setting-toggle-row { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.setting-toggle { width: 40px; height: 22px; appearance: none; -webkit-appearance: none; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1); border-radius: 99px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.setting-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,0.8); transition: transform 0.2s, background 0.2s; }
.setting-toggle:checked { background: #34d399; border-color: #34d399; }
.setting-toggle:checked::after { transform: translateX(18px); background: #fff; }
.setting-toggle:disabled { opacity: 0.3; cursor: not-allowed; }
.local-save-tip { background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.12); border-radius: 10px; padding: 12px 16px; }
.local-save-tip p { margin: 0; font-size: 12px; color: rgba(255,255,255,0.5); line-height: 1.6; }
body.theme-light .local-save-path { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: rgba(0,0,0,0.5); }
body.theme-light .local-save-path.has-folder { color: #10b981; border-color: rgba(16,185,129,0.25); }
body.theme-light .setting-toggle { background: rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.1); }
body.theme-light .setting-toggle::after { background: rgba(0,0,0,0.6); }
body.theme-light .setting-toggle:checked { background: #10b981; border-color: #10b981; }
body.theme-light .setting-toggle:checked::after { background: #fff; }
body.theme-light .local-save-tip { background: rgba(99,102,241,0.06); border-color: rgba(99,102,241,0.15); }
body.theme-light .local-save-tip p { color: rgba(0,0,0,0.5); }

/* ============================================================================
   移动端全面优化 — 触摸目标 / 代码块 / 输入栏 / 侧边栏
   ============================================================================ */
@media (max-width: 768px) {
    /* === 1. 顶部栏按钮 ≥ 44px + 固定定位防止键盘弹出时消失 === */
    /* 移动端改用 fixed 定位，防止键盘弹出时顶部按钮滚走 */
    .mobile-menu-btn {
        position: fixed !important;
        top: 20px !important;
        left: 16px !important;
        z-index: 10000 !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    .top-left-console {
        position: fixed !important;
        top: 20px !important;
        left: 68px !important;
        z-index: 10000 !important;
    }
    .top-action-wrapper {
        position: fixed !important;
        top: 20px !important;
        right: 16px !important;
        z-index: 10000 !important;
    }
    /* 侧边栏打开时隐藏顶部固定按钮，防止浮在侧边栏上方 */
    body.sidebar-open .mobile-menu-btn,
    body.sidebar-open .top-left-console,
    body.sidebar-open .top-action-wrapper {
        display: none !important;
    }
    /* 历史抽屉打开时同样隐藏顶部固定按钮 */
    body.history-drawer-open .mobile-menu-btn,
    body.history-drawer-open .top-left-console,
    body.history-drawer-open .top-action-wrapper {
        display: none !important;
    }
    .history-drawer-close {
        min-width: 44px !important;
        min-height: 44px !important;
    }
    /* 历史记录删除按钮：移动端始终显示 + 增大触摸区域 */
    .history-item-delete,
    .history-delete-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        opacity: 0.6 !important;
    }

    /* === 2. 消息操作按钮：增大触摸区域 === */
    .msg-action-btn {
        min-height: 36px !important;
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
    .message-actions {
        gap: 6px !important;
        opacity: 1 !important; /* 移动端无 hover，始终显示 */
    }

    /* === 3. 底部工具栏按钮 ≥ 44px === */
    .asset-entry-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    .asset-entry-icon {
        width: 40px !important;
        height: 40px !important;
    }
    .tool-btn {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    /* === 4. 路由策略按钮：加宽，确保可点击 === */
    .route-trigger-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 8px 12px !important;
        max-width: 120px !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
    }
    .route-trigger-label {
        font-size: 12px !important;
        max-width: 72px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: inline-block !important;
    }
    /* 收起状态下保持原始设计：toolbar-left 隐藏，不遮挡输入框 */

    /* === 4b. toolbar 防止换行：移动端禁止 wrap === */
    .input-toolbar {
        flex-wrap: nowrap !important;
    }
    .input-toolbar-left {
        flex-shrink: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    /* === 4c. 价格徽章不遮挡输入框文字 === */
    .chat-price-badge {
        font-size: 10px !important;
        padding: 3px 8px !important;
        max-width: 80px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        right: 10px !important;
        top: 10px !important;
    }
    /* 展开状态下输入框右侧留出价格徽章空间 */
    .chat-input-box:not(.composer-collapsed) #messageInput,
    .chat-input-box:not(.composer-collapsed) .rich-input {
        padding-right: 96px !important;
    }

    /* === 4d. 参考图占位图：移动端缩小 === */
    .reference-stage {
        width: 80px !important;
        height: 56px !important;
    }
    .empty-reference-trigger {
        width: 44px !important;
        height: 44px !important;
    }
    .empty-reference-content span {
        display: none !important;
    }
    .empty-reference-icon svg {
        width: 18px !important;
        height: 18px !important;
    }
    /* 有参考图时输入框 padding 适配移动端 */
    .chat-input-box.has-reference-stage #messageInput,
    .chat-input-box.has-reference-stage .rich-input {
        padding-left: 96px !important;
    }
    .chat-input-box.composer-collapsed.has-reference-stage #messageInput,
    .chat-input-box.composer-collapsed.has-reference-stage .rich-input {
        padding-left: 80px !important;
    }

    /* === 5. 侧边栏充值按钮：增大触摸区域 === */
    .wallet-recharge-btn {
        min-height: 40px !important;
        padding: 8px 16px !important;
    }
    .wallet-user-card {
        min-height: 60px !important;
    }

    /* === 6. 代码块：防止溢出消息气泡 === */
    .message-content pre,
    .message-body pre {
        max-width: 100% !important;
        overflow-x: auto !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
    }
    .message-content pre code,
    .message-body pre code {
        word-break: break-all !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* === 7. 输入栏底部安全区 + 间距优化 === */
    .input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .chat-input-box {
        padding: 8px 8px !important;
    }
    .rich-input {
        min-height: 44px !important;
    }

    /* === 9. 侧边栏模型列表项：增大触摸区域 === */
    .model-item {
        min-height: 72px !important;
    }
    .model-tabs .tab-item {
        min-height: 36px !important;
        padding: 6px 10px !important;
    }

    /* === 10. 发送按钮确保 ≥ 44px === */
    .send-btn,
    button[class*="send"] {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    /* === 10b. 消息操作按钮强制横排，禁止换行竖排 === */
    .message-actions {
        flex-wrap: nowrap !important;
        overflow: visible !important;
    }
    .message-footer .message-actions {
        flex-wrap: nowrap !important;
    }

    /* === 10c. 移动端隐藏计费信息（输入/输出/消耗） === */
    .message-billing {
        display: none !important;
    }

    /* === 11. 右上角功能菜单弹窗 === */
    .action-popover {
        position: fixed !important;
        width: calc(100vw - 24px) !important;
        left: 12px !important;
        right: auto !important;
        top: 70px !important;
        transform: none !important;
        max-height: calc(100vh - 100px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .action-menu-grid {
        width: 100% !important;
    }
    .action-menu-item {
        min-height: 56px !important;
        padding: 10px 12px !important;
    }
    .action-menu-item .menu-name {
        font-size: 14px !important;
    }
    .action-menu-item .menu-desc {
        font-size: 11px !important;
    }

    /* === 12. 路由策略弹窗：适配移动端 === */
    .route-strategy-popup {
        width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 120px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        left: 12px !important;
        transform: none !important;
    }
    .route-popup-card {
        max-height: none !important;
    }
    .route-popup-channel-list {
        max-height: 300px !important;
        -webkit-overflow-scrolling: touch;
    }
    .route-popup-option {
        min-height: 44px !important;
        padding: 10px 12px !important;
    }
    .route-popup-channel {
        min-height: 56px !important;
        padding: 10px 12px !important;
    }
    .route-popup-help-link {
        min-height: 28px !important;
        padding: 4px 8px !important;
    }

    /* === 13. 充值弹窗：适配移动端 === */
    .chat-recharge-modal {
        width: 94vw !important;
        max-width: 94vw !important;
        max-height: 88vh !important;
        border-radius: 12px !important;
        -webkit-overflow-scrolling: touch;
    }
    .chat-recharge-header {
        padding: 16px 16px 8px !important;
    }
    .chat-recharge-close {
        top: 14px !important;
        right: 14px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* === 14. 签到弹窗：适配移动端 === */
    .checkin-modal {
        width: 94vw !important;
        max-width: 94vw !important;
        max-height: 88vh !important;
        border-radius: 12px !important;
        -webkit-overflow-scrolling: touch;
    }

    /* === 15. 侧边栏：移动端全屏适配 === */
    .sidebar {
        width: 85vw !important;
        max-width: 320px !important;
    }
    .sidebar-header {
        padding: 12px 14px !important;
    }
    .sidebar-footer {
        padding: 10px 14px !important;
    }

    /* === 16. 历史记录抽屉：适配移动端 === */
    .history-drawer {
        width: 85vw !important;
        max-width: 320px !important;
    }
    .history-drawer-header {
        padding: 12px 14px !important;
    }
    .history-drawer-content {
        -webkit-overflow-scrolling: touch;
    }

    /* === 17. 接入模式弹窗：移动端可滚动 === */
    .mode-selector-modal {
        max-height: 92vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .ms-modal-right {
        max-height: none !important;
        overflow-y: visible !important;
    }
    .ms-modal-left {
        padding: 16px 16px 8px !important;
    }
    .ms-modal-right {
        padding: 16px !important;
    }
    .ms-side-card {
        padding: 12px 10px !important;
        margin-bottom: 6px !important;
    }
    .ms-api-config {
        padding: 0 !important;
    }
    .ms-form-input {
        min-height: 44px !important;
        font-size: 14px !important;
    }
    .ms-modal-footer {
        padding-top: 12px !important;
        gap: 10px !important;
    }
    .ms-modal-footer button {
        min-height: 44px !important;
        flex: 1;
    }
}
/* Completed videos whose upstream content cannot be restored. */
.video-recovery-card {
    width: min(420px, 100%);
    padding: 18px 20px;
    border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, currentColor 5%, transparent);
}
.video-recovery-title { font-weight: 600; margin-bottom: 6px; }
.video-recovery-detail { opacity: .65; font-size: 12px; line-height: 1.5; margin-bottom: 12px; }
.video-recovery-retry {
    border: 0;
    border-radius: 8px;
    padding: 7px 12px;
    cursor: pointer;
    color: inherit;
    background: color-mix(in srgb, currentColor 12%, transparent);
}
.video-recovery-retry:hover { background: color-mix(in srgb, currentColor 20%, transparent); }

/* Role manager v2: compact product-style workspace */
.role-manager-panel {
    width: min(900px, calc(100vw - 32px));
    max-height: min(82vh, 820px);
    border-radius: 24px;
    background: rgba(14, 16, 24, .98);
    border-color: rgba(148, 163, 184, .16);
}
.role-manager-header { padding: 24px 26px 16px; }
.role-manager-heading h3 { font-size: 24px; letter-spacing: -.01em; }
.role-manager-heading p { max-width: 520px; font-size: 13px; color: rgba(226, 232, 240, .58); }
.role-manager-tabs {
    gap: 4px;
    padding: 14px 26px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.role-manager-tab {
    border: 0;
    border-radius: 9px;
    padding: 9px 13px;
    color: rgba(226, 232, 240, .58);
    background: transparent;
}
.role-manager-tab.active, .role-manager-tab:hover {
    color: #f8fafc;
    background: rgba(99, 102, 241, .16);
}
.role-manager-pane { padding: 18px 26px 26px; }
.role-manager-current {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 13px;
    border-color: rgba(129, 140, 248, .22);
    background: rgba(99, 102, 241, .08);
}
.role-manager-current-text { font-size: 13px; color: #dbeafe; }
.role-manager-list { gap: 12px; }
.role-card {
    padding: 15px;
    border-radius: 16px;
    border-color: rgba(148, 163, 184, .13);
    background: rgba(30, 41, 59, .36);
}
.role-card:hover { transform: translateY(-1px); background: rgba(51, 65, 85, .42); }
.role-card.is-active { border-color: rgba(129, 140, 248, .6); box-shadow: 0 0 0 1px rgba(129, 140, 248, .14), 0 12px 28px rgba(0, 0, 0, .18); }
.role-card-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #e0e7ff;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.role-card-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.role-card-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-active-mark { flex: 0 0 auto; padding: 3px 6px; border-radius: 5px; color: #a5b4fc; background: rgba(99, 102, 241, .16); font-size: 10px; }
.role-card-desc { margin-top: 4px; font-size: 12px; }
.role-card-prompt { margin-top: 12px; padding: 10px; border-radius: 10px; font-size: 12px; line-height: 1.55; -webkit-line-clamp: 3; }
.role-card-actions { margin-top: 12px; gap: 7px; }
.role-primary-btn, .role-secondary-btn, .role-ghost-btn { border-radius: 9px; font-size: 12px; padding: 8px 11px; }
.role-primary-btn { color: #eef2ff; background: rgba(99, 102, 241, .23); border-color: rgba(129, 140, 248, .34); }
.role-secondary-btn, .role-ghost-btn { color: rgba(226, 232, 240, .72); background: rgba(148, 163, 184, .07); border-color: rgba(148, 163, 184, .16); }
.role-form-grid { gap: 12px; }
.role-form-field { gap: 7px; font-size: 12px; color: rgba(226, 232, 240, .72); }
.role-form-field input, .role-form-field textarea { border-radius: 11px; padding: 11px 12px; font-size: 13px; border-color: rgba(148, 163, 184, .16); background: rgba(30, 41, 59, .42); }
.role-form-field textarea { min-height: 180px; }
.role-form-actions { margin-top: 14px; }
body.theme-light .role-manager-panel { background: rgba(255, 255, 255, .98); border-color: rgba(15, 23, 42, .12); }
body.theme-light .role-manager-tabs { border-bottom-color: rgba(15, 23, 42, .1); }
body.theme-light .role-manager-tab { color: rgba(15, 23, 42, .56); }
body.theme-light .role-manager-tab.active, body.theme-light .role-manager-tab:hover { color: #312e81; background: rgba(99, 102, 241, .1); }
body.theme-light .role-manager-heading h3, body.theme-light .role-card-title { color: #111827; }
body.theme-light .role-manager-heading p, body.theme-light .role-card-desc, body.theme-light .role-form-field { color: rgba(15, 23, 42, .58); }
body.theme-light .role-manager-current { border-color: rgba(99, 102, 241, .18); background: rgba(99, 102, 241, .06); }
body.theme-light .role-manager-current-text { color: #3730a3; }
body.theme-light .role-card { border-color: rgba(15, 23, 42, .1); background: rgba(248, 250, 252, .9); }
body.theme-light .role-card:hover { background: #f8fafc; }
body.theme-light .role-card-prompt { color: rgba(15, 23, 42, .62); background: rgba(15, 23, 42, .035); border-color: rgba(15, 23, 42, .08); }
body.theme-light .role-form-field input, body.theme-light .role-form-field textarea { color: #111827; background: #f8fafc; border-color: rgba(15, 23, 42, .12); }
body.theme-light .role-secondary-btn, body.theme-light .role-ghost-btn { color: rgba(15, 23, 42, .68); background: #fff; border-color: rgba(15, 23, 42, .12); }
@media (max-width: 640px) {
    .role-manager-panel { width: calc(100vw - 20px); max-height: 90vh; border-radius: 20px; }
    .role-manager-header, .role-manager-pane { padding-left: 16px; padding-right: 16px; }
    .role-manager-list, .role-form-grid { grid-template-columns: 1fr; }
}

/* Role manager visual correction: clearer hierarchy and less dashboard-like cards */
.role-manager-panel {
    width: min(940px, calc(100vw - 28px)) !important;
    max-height: min(80vh, 760px) !important;
    border-radius: 20px !important;
}
.role-manager-header {
    padding: 22px 24px 15px !important;
    background: rgba(255, 255, 255, .025);
}
.role-manager-kicker { padding: 4px 8px !important; font-size: 10px !important; letter-spacing: .12em !important; }
.role-manager-heading h3 { margin: 8px 0 5px !important; font-size: 23px !important; }
.role-manager-heading p { font-size: 12px !important; }
.role-manager-close { width: 36px !important; height: 36px !important; border-radius: 10px !important; }
.role-manager-tabs { padding: 12px 24px !important; }
.role-manager-pane { padding: 16px 24px 22px !important; }
.role-manager-current { padding: 10px 12px !important; border-radius: 11px !important; }
.role-manager-list { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
.role-card {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    padding: 13px !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, .035) !important;
    box-shadow: none !important;
}
.role-card-head { gap: 10px !important; }
.role-card-avatar { width: 32px !important; height: 32px !important; flex-basis: 32px !important; border-radius: 9px !important; font-size: 13px !important; }
.role-card-title-line { gap: 6px !important; }
.role-card-title { font-size: 13px !important; }
.role-active-mark { font-size: 9px !important; padding: 2px 5px !important; }
.role-card-desc { margin-top: 3px !important; font-size: 11px !important; line-height: 1.35 !important; }
.role-card-prompt { margin: 10px 0 0 !important; padding: 9px !important; font-size: 11px !important; line-height: 1.45 !important; -webkit-line-clamp: 2 !important; }
.role-card-actions { margin-top: auto !important; padding-top: 10px !important; gap: 6px !important; }
.role-card-actions button { min-height: 30px !important; padding: 6px 10px !important; border-radius: 8px !important; font-size: 11px !important; }
body.theme-light .role-manager-panel { background: #f7f8fc !important; box-shadow: 0 24px 70px rgba(15, 23, 42, .18) !important; }
body.theme-light .role-manager-header { background: #fff !important; border-bottom-color: #e7eaf1 !important; }
body.theme-light .role-manager-tabs { background: #fff !important; border-bottom-color: #e7eaf1 !important; }
body.theme-light .role-manager-current { background: #eef2ff !important; border-color: #d9ddff !important; }
body.theme-light .role-card { background: #fff !important; border-color: #e4e7ef !important; box-shadow: 0 5px 16px rgba(15, 23, 42, .045) !important; }
body.theme-light .role-card:hover { border-color: #c9cef9 !important; box-shadow: 0 8px 22px rgba(79, 70, 229, .08) !important; }
body.theme-light .role-card.is-active { border-color: #818cf8 !important; box-shadow: 0 0 0 2px rgba(99, 102, 241, .12), 0 8px 22px rgba(79, 70, 229, .09) !important; }
@media (max-width: 640px) {
    .role-manager-list { grid-template-columns: 1fr !important; }
    .role-manager-panel { max-height: 88vh !important; }
}

/* Role manager workspace layout */
.role-manager-workspace { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: 430px; overflow: hidden; }
.role-library-pane { padding: 18px 14px 20px 24px; border-right: 1px solid rgba(148, 163, 184, .14); overflow: auto; }
.role-library-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; }
.role-library-heading strong { display: block; font-size: 13px; }
.role-library-heading span { display: block; margin-top: 3px; color: rgba(148, 163, 184, .65); font-size: 11px; }
.role-new-mini { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(129, 140, 248, .35); border-radius: 8px; color: #c7d2fe; background: rgba(99, 102, 241, .14); cursor: pointer; font-size: 18px; line-height: 1; }
.role-manager-workspace .role-manager-current { margin-bottom: 10px; }
.role-manager-workspace .role-manager-list { display: flex; flex-direction: column; gap: 5px; }
.role-library-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid transparent; border-radius: 10px; color: inherit; background: transparent; text-align: left; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.role-library-item:hover { background: rgba(148, 163, 184, .08); }
.role-library-item.is-selected { border-color: rgba(129, 140, 248, .3); background: rgba(99, 102, 241, .12); }
.role-library-avatar, .role-preview-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: #eef2ff; background: linear-gradient(135deg, #6366f1, #8b5cf6); font-weight: 700; }
.role-library-avatar { width: 32px; height: 32px; font-size: 13px; }
.role-library-copy { min-width: 0; flex: 1; }
.role-library-copy strong, .role-library-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-library-copy strong { font-size: 12px; font-weight: 650; }
.role-library-copy small { margin-top: 3px; color: rgba(148, 163, 184, .66); font-size: 10px; }
.role-library-check { color: #a5b4fc; font-size: 15px; }
.role-preview-pane { display: flex; flex-direction: column; min-width: 0; padding: 30px 34px; background: rgba(255, 255, 255, .018); }
.role-preview-topline { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.role-preview-label { color: rgba(148, 163, 184, .7); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.role-preview-active { padding: 4px 7px; border-radius: 5px; color: #a5b4fc; background: rgba(99, 102, 241, .14); font-size: 10px; }
.role-preview-heading { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.role-preview-avatar { width: 50px; height: 50px; border-radius: 15px; font-size: 20px; }
.role-preview-heading h4 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.role-preview-heading p { margin: 5px 0 0; color: rgba(148, 163, 184, .7); font-size: 12px; }
.role-preview-section { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(148, 163, 184, .14); }
.role-preview-section > span { color: rgba(148, 163, 184, .64); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.role-preview-section p { margin: 10px 0 0; max-height: 150px; overflow: auto; color: rgba(226, 232, 240, .82); font-size: 13px; line-height: 1.75; white-space: pre-wrap; }
.role-preview-prompt-card { margin-top: 10px; max-height: 190px; overflow: auto; padding: 15px 16px; border: 1px solid rgba(148, 163, 184, .14); border-radius: 12px; color: rgba(226, 232, 240, .84); background: rgba(148, 163, 184, .07); font-size: 13px; line-height: 1.75; white-space: pre-wrap; }
.role-preview-actions { display: flex; gap: 8px; margin-top: 22px; padding-top: 0; }
.role-preview-empty, .role-library-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; color: rgba(148, 163, 184, .72); }
.role-preview-empty { justify-content: center; align-items: center; height: 100%; text-align: center; }
.role-preview-empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 6px; border-radius: 15px; color: #c7d2fe; background: rgba(99, 102, 241, .14); font-size: 22px; }
.role-preview-empty strong, .role-library-empty strong { color: inherit; font-size: 14px; }
.role-preview-empty span, .role-library-empty span { font-size: 12px; line-height: 1.5; }
.role-library-empty .role-primary-btn { margin-top: 8px; }
body.theme-light .role-library-pane { border-right-color: #e5e7eb; background: #fbfcfe; }
body.theme-light .role-library-heading strong, body.theme-light .role-preview-heading h4 { color: #111827; }
body.theme-light .role-library-item:hover { background: #f1f3f8; }
body.theme-light .role-library-item.is-selected { background: #eef2ff; border-color: #c7d2fe; }
body.theme-light .role-preview-pane { background: #fff; }
body.theme-light .role-preview-heading p, body.theme-light .role-preview-section > span { color: #64748b; }
body.theme-light .role-preview-section { border-top-color: #e5e7eb; }
body.theme-light .role-preview-section p { color: #334155; }
body.theme-light .role-preview-prompt-card { color: #334155; background: #f8fafc; border-color: #e2e8f0; }
body.theme-light .role-preview-empty strong, body.theme-light .role-library-empty strong { color: #334155; }
@media (max-width: 720px) {
    .role-manager-workspace { grid-template-columns: 1fr; min-height: 0; }
    .role-library-pane { max-height: 265px; padding: 15px 16px; border-right: 0; border-bottom: 1px solid rgba(148, 163, 184, .14); }
    .role-preview-pane { min-height: 300px; padding: 22px 18px; }
}
