/* chat.css
 * Extracted from index.html inline styles (v20260325)
 * 聊天页面专用样式：消息动画 / 卡片 / 模态框 / 预览面板 / 响应式
 */
/* 滚动条样式 - 使用全局主题变量 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

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

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

/* 消息动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ========== 思考指示器 - Gemini 风格 ========== */

/* 圆点波浪跳动 */
@keyframes dotWave {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.typing-dot {
    animation: dotWave 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

/* 圆点发光效果 */
.typing-dot-glow {
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}

/* 头像脉冲光环 */
@keyframes thinkingPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
    }
}

.thinking-avatar {
    animation: thinkingPulse 2s ease-in-out infinite;
}

/* 气泡微光扫过 */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.thinking-bubble {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(139, 92, 246, 0.08) 40%,
            rgba(59, 130, 246, 0.08) 60%,
            rgba(255, 255, 255, 0.03) 100%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

/* 思考计时器 */
.thinking-timer {
    font-variant-numeric: tabular-nums;
    font-family: 'Inter', ui-monospace, monospace;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    cursor: default;
    user-select: none;
    min-width: 2.5rem;
}

.thinking-timer:hover {
    color: rgba(255, 255, 255, 0.65);
}

/* 思考文字呼吸 */
@keyframes thinkingTextBreath {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.thinking-text {
    animation: thinkingTextBreath 2.5s ease-in-out infinite;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
}

/* 回复消息上的耗时标签 */
.thinking-duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    font-variant-numeric: tabular-nums;
    padding: 1px 0;
    margin-bottom: 2px;
    transition: color 0.2s;
    cursor: default;
}

.thinking-duration-badge:hover {
    color: rgba(255, 255, 255, 0.6);
}

/* 文件上传区域 */
.upload-zone {
    border: 2.5px dashed rgba(192, 132, 252, 0.35);
    transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: rgba(192, 132, 252, 0.6);
    background: rgba(192, 132, 252, 0.06);
}

/* ========== 氛围光背景 ========== */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.22;
    pointer-events: none;
    z-index: 0;
}

.ambient-glow-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    top: 5%;
    left: 20%;
}

.ambient-glow-2 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, #60a5fa, transparent 70%);
    top: 25%;
    right: 15%;
}

.ambient-glow-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #f472b6, transparent 70%);
    bottom: 20%;
    left: 30%;
    opacity: 0.14;
}

/* ========== Logo浮动动画 ========== */
@keyframes floatGently {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.logo-float {
    animation: floatGently 4s ease-in-out infinite;
}

.logo-glow {
    box-shadow: 0 0 50px rgba(167, 139, 250, 0.4), 0 0 100px rgba(96, 165, 250, 0.2), 0 0 20px rgba(244, 114, 182, 0.15);
}

/* ========== 渐变文字 ========== */
.text-gradient {
    background: linear-gradient(135deg, #c084fc, #818cf8, #60a5fa, #f0abfc);
    background-size: 200% 100%;
    animation: gradientShift 4s ease-in-out infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ========== 输入框拖拽上传覆盖层 ========== */
.input-drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    border: 2.5px dashed rgba(167, 139, 250, 0.6);
    background: rgba(167, 139, 250, 0.08);
    z-index: 50;
    pointer-events: none;
    align-items: center;
    justify-content: center;
}

.input-drop-overlay.active {
    display: flex;
}

/* ========== 卡片样式 ========== */
.glass-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.glass-card:hover {
    background: rgba(167, 139, 250, 0.06);
    border-color: rgba(167, 139, 250, 0.35);
    box-shadow: 0 8px 32px rgba(167, 139, 250, 0.12), 0 0 0 1px rgba(167, 139, 250, 0.08);
    transform: translateY(-2px);
}

.glass-card-upload {
    border-color: rgba(192, 132, 252, 0.2);
}

.glass-card-upload:hover {
    border-color: rgba(192, 132, 252, 0.45);
    box-shadow: 0 8px 32px rgba(192, 132, 252, 0.15);
}

.glass-card-demo {
    border-color: rgba(96, 165, 250, 0.15);
}

.glass-card-demo:hover {
    background: rgba(96, 165, 250, 0.06);
    border-color: rgba(96, 165, 250, 0.35);
    box-shadow: 0 8px 32px rgba(96, 165, 250, 0.12);
}

/* ========== 服务模式胶囊按钮 (豆包风格) ========== */
.svc-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
}

.svc-mode-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

.svc-mode-btn.active {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(96, 165, 250, 0.2));
    border-color: rgba(167, 139, 250, 0.4);
    color: #fff;
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.15);
}

.svc-mode-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.svc-mode-icon {
    font-size: 14px;
    line-height: 1;
}

/* ========== 合并药丸 · 高亮独立入口样式 ========== */
.svc-mode-btn.svc-mode-conso {
    position: relative;
    padding: 5px 14px 5px 12px;
    background: linear-gradient(135deg,
            rgba(139, 92, 246, 0.18) 0%,
            rgba(99, 102, 241, 0.18) 50%,
            rgba(59, 130, 246, 0.18) 100%);
    border: 1px solid rgba(139, 92, 246, 0.45);
    color: #e9d5ff;
    box-shadow:
        0 0 0 1px rgba(139, 92, 246, 0.08) inset,
        0 2px 10px rgba(139, 92, 246, 0.18);
    overflow: hidden;
}

.svc-mode-btn.svc-mode-conso::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            transparent 0%,
            rgba(167, 139, 250, 0.12) 50%,
            transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.svc-mode-btn.svc-mode-conso:hover:not(.disabled) {
    background: linear-gradient(135deg,
            rgba(139, 92, 246, 0.32) 0%,
            rgba(99, 102, 241, 0.32) 50%,
            rgba(59, 130, 246, 0.32) 100%);
    border-color: rgba(167, 139, 250, 0.7);
    color: #fff;
    box-shadow:
        0 0 0 1px rgba(167, 139, 250, 0.2) inset,
        0 4px 16px rgba(139, 92, 246, 0.35);
    transform: translateY(-1px);
}

.svc-mode-btn.svc-mode-conso:hover:not(.disabled)::before {
    opacity: 1;
}

.svc-mode-btn.svc-mode-conso .svc-mode-icon {
    filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.6));
}

.svc-mode-btn.svc-mode-conso .svc-mode-ext {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 2px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.28);
    color: #ddd6fe;
    font-size: 9px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.svc-mode-btn.svc-mode-conso:hover:not(.disabled) .svc-mode-ext {
    background: rgba(167, 139, 250, 0.5);
    transform: translate(1px, -1px);
}

/* 脉冲光环 — 首次吸引注意 */
@keyframes svcConsoPulse {

    0%,
    100% {
        box-shadow:
            0 0 0 1px rgba(139, 92, 246, 0.08) inset,
            0 2px 10px rgba(139, 92, 246, 0.18),
            0 0 0 0 rgba(167, 139, 250, 0.4);
    }

    50% {
        box-shadow:
            0 0 0 1px rgba(167, 139, 250, 0.18) inset,
            0 2px 14px rgba(139, 92, 246, 0.3),
            0 0 0 6px rgba(167, 139, 250, 0);
    }
}

.svc-mode-btn.svc-mode-conso {
    animation: svcConsoPulse 2.8s ease-in-out infinite;
}

.svc-mode-label {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ========== 功能按钮 ========== */
.action-btn {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(59, 130, 246, 0.05));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.action-btn:hover {
    border-color: rgba(167, 139, 250, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.1);
}

.action-btn:hover::before {
    opacity: 1;
}

.action-btn-gold {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.action-btn-gold:hover {
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: 0 4px 24px rgba(251, 191, 36, 0.15), 0 0 0 1px rgba(251, 191, 36, 0.08);
}

.action-btn-gold::before {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(245, 158, 11, 0.08));
}

/* ========== 图标容器 ========== */
.icon-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:hover .icon-circle {
    transform: scale(1.08);
}

/* ========== 入场动画 ========== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out both;
}

.delay-1 {
    animation-delay: 0.08s;
}

.delay-2 {
    animation-delay: 0.16s;
}

.delay-3 {
    animation-delay: 0.24s;
}

.delay-4 {
    animation-delay: 0.32s;
}

.delay-5 {
    animation-delay: 0.40s;
}

/* 即将推出徽章 */
.coming-soon-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    font-size: 0.5rem;
    padding: 1px 5px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(168, 130, 255, 0.45), rgba(96, 165, 250, 0.4));
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
}

.suggest-coming-soon {
    opacity: 0.55;
}

.suggest-coming-soon:hover {
    opacity: 0.72;
}

/* 怎么使用弹窗 */
.help-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.help-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.help-modal {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    max-width: 520px;
    width: 90vw;
    padding: 2rem;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* ========== 资料准备指南弹窗 ========== */
.material-guide-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.material-guide-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.material-guide-modal {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    max-width: 680px;
    width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.75rem;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: material-guide-enter 0.3s ease;
}

@keyframes material-guide-enter {
    from {
        transform: translateY(12px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.material-guide-modal table {
    border-collapse: collapse;
}

.material-guide-modal table td,
.material-guide-modal table th {
    white-space: nowrap;
}

.material-guide-modal table td:last-child,
.material-guide-modal table th:last-child {
    white-space: normal;
}

.help-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.875rem 0;
}

.help-step:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.help-step-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary, #8b5cf6), var(--brand-secondary, #3b82f6));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

/* 滚动到底部按钮 - ChatGPT风格，位于输入框正上方 */
.scroll-to-bottom-btn {
    position: absolute;
    top: -3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: rgba(66, 66, 77, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-to-bottom-btn:hover {
    background: rgba(90, 90, 105, 1);
    color: #fff;
    transform: translateX(-50%) scale(1.08);
}

.scroll-to-bottom-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* 移动端：按钮位于输入框上方，确保不被裁切 */
@media (max-width: 767px) {
    .scroll-to-bottom-btn {
        top: -2.75rem;
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* 有新内容时的跳转按钮 - 大厂标准交互 */
.scroll-to-bottom-btn.has-new {
    background: rgba(59, 130, 246, 0.95);
    border-color: rgba(99, 160, 255, 0.5);
    box-shadow: 0 2px 16px rgba(59, 130, 246, 0.4);
    animation: scrollBtnBounce 2s ease-in-out infinite;
}

.scroll-to-bottom-btn.has-new:hover {
    background: rgba(79, 150, 255, 1);
    animation: none;
}

/* 绿色小圆点 - 新消息指示器 */
.scroll-to-bottom-btn.has-new::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid rgba(30, 30, 38, 1);
    animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes scrollBtnBounce {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@keyframes dotPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.8);
    }
}

/* 进度条动画 */
.progress-bar {
    transition: width 0.5s ease-out;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary), var(--color-success));
    background-size: 200% 100%;
    animation: progressShimmer 2s linear infinite;
}

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

    100% {
        background-position: -100% 0;
    }
}

/* 排队等待动画 — 缓慢脉冲 */
.progress-bar.queue-waiting {
    background: linear-gradient(90deg, #4b5563, #6366f1, #4b5563);
    background-size: 300% 100%;
    animation: queuePulse 2.5s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes queuePulse {

    0%,
    100% {
        background-position: 0% 50%;
        opacity: 0.5;
    }

    50% {
        background-position: 100% 50%;
        opacity: 0.9;
    }
}

/* ========== 消息操作按钮 - ChatGPT 风格 ========== */
.message-wrapper {
    position: relative;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.message-wrapper:hover .message-actions,
.message-actions.pinned {
    opacity: 1;
    pointer-events: auto;
}

/* 移动端：始终显示操作按钮 */
@media (max-width: 768px) {
    .message-actions {
        opacity: 0.6;
        pointer-events: auto;
    }

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

.msg-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.msg-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.msg-action-btn:active {
    transform: scale(0.9);
}

.msg-action-btn.active {
    color: var(--brand-primary, #8b5cf6);
}

/* 复制成功提示 */
.msg-action-btn .copy-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(34, 197, 94, 0.95);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 4px;
}

.msg-action-btn .copy-tooltip.show {
    opacity: 1;
}

/* ========== 无痕模式 Popover ========== */
.privacy-popover-trigger {
    position: relative;
    cursor: pointer;
}

.privacy-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 16px;
    padding: 20px;
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 200;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(16, 185, 129, 0.08);
}

.privacy-popover.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.privacy-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: rgba(15, 23, 42, 0.97);
    border-top: 1px solid rgba(16, 185, 129, 0.15);
    border-left: 1px solid rgba(16, 185, 129, 0.15);
    transform: rotate(45deg);
}

.privacy-popover.popover-bottom {
    top: calc(100% + 6px);
}

.privacy-popover.popover-bottom::before {
    right: auto;
    left: 16px;
}

.privacy-popover .popover-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
}

.privacy-popover .popover-item svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.privacy-popover .popover-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(16, 185, 129, 0.15), transparent);
    margin: 12px 0;
}

.privacy-popover .popover-footer a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: rgba(52, 211, 153, 0.6);
    text-decoration: none;
    transition: color 0.15s;
}

.privacy-popover .popover-footer a:hover {
    color: rgba(52, 211, 153, 1);
}

/* 用户消息操作按钮 - 靠右对齐 */
.message-actions.user-actions {
    justify-content: flex-end;
}

/* 终端日志窗口 */
.log-window {
    background: var(--bg-primary);
    border-radius: 8px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
}

.log-line {
    color: var(--text-secondary);
    line-height: 1.4;
    animation: logFadeIn 0.3s ease-out forwards;
    opacity: 0;
}

@keyframes logFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-line.success {
    color: var(--color-success);
}

.log-line.info {
    color: var(--brand-primary);
}

.log-line.warning {
    color: var(--color-warning);
}

/* 计时器脉冲 */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.timer-pulse {
    animation: pulse 1s infinite;
}

/* 步骤完成动画 */
.step-done {
    color: var(--color-success);
}

.step-running {
    color: var(--brand-primary);
    animation: pulse 1s infinite;
}

/* 下拉框样式（黑色背景下可见） */
.dark-select {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.dark-select option {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    padding: 8px;
}

/* 设置面板 - 右侧滑出 */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-overlay.active {
    opacity: 1;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-default);
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.settings-panel.active {
    transform: translateX(0);
}

@media (max-width: 480px) {
    .settings-panel {
        width: 100vw;
    }
}

/* ⭐ 侧边栏可拖拽宽度 */
:root {
    --sidebar-width: 256px;
    --preview-width: 0px;
}

@media (min-width: 768px) {
    #sidebar {
        width: var(--sidebar-width) !important;
    }

    #top-navbar {
        left: var(--sidebar-width) !important;
        right: var(--preview-width) !important;
    }

    #chat-input-area {
        left: var(--sidebar-width) !important;
        right: var(--preview-width) !important;
    }

    main.md\:ml-64 {
        margin-left: var(--sidebar-width) !important;
        margin-right: var(--preview-width) !important;
    }
}

/* ========== 文件预览面板 ========== */
#file-preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--preview-width);
    background: var(--bg-darker, #111827);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 40;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#file-preview-panel.hidden-panel {
    width: 0 !important;
}

#preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(17, 24, 39, 0.95);
    min-height: 56px;
    flex-shrink: 0;
}

#preview-header .preview-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

#preview-header .preview-title {
    flex: 1;
    min-width: 0;
}

#preview-header .preview-filename {
    font-size: 13px;
    font-weight: 600;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#preview-header .preview-filesize {
    font-size: 11px;
    color: #6b7280;
}

#preview-header .preview-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.15s;
    flex-shrink: 0;
    border: none;
    background: transparent;
}

#preview-header .preview-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

#preview-content {
    flex: 1;
    overflow: auto;
    position: relative;
    min-height: 0;
}

#preview-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #1e1e2e;
}

#preview-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    padding: 16px;
}

#preview-content pre {
    padding: 16px;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    color: #cdd6f4;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
}

#preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #4b5563;
    gap: 12px;
}

#preview-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

/* 预览面板拖拽调整宽度 */
#preview-resize-handle {
    position: absolute;
    top: 0;
    left: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 50;
    transition: background 0.15s;
}

#preview-resize-handle:hover,
#preview-resize-handle.active {
    background: rgba(99, 102, 241, 0.5);
}

/* 预览面板内的 loading spinner */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: #6b7280;
}

.preview-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 不支持预览类型的提示 */
.preview-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: #6b7280;
    text-align: center;
    padding: 24px;
}

.preview-unsupported .file-ext {
    font-size: 32px;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
}

#sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 50;
    transition: background 0.15s;
}

#sidebar-resize-handle:hover,
#sidebar-resize-handle.active {
    background: rgba(99, 102, 241, 0.5);
}

/* ========== 移动端输入区安全区域 + 消息流底部间距修复 ========== */
/* 输入区底部要加上 safe-area-inset-bottom（iPhone X+ 底部横条） */
#chat-input-area {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 移动端响应式 */
@media (max-width: 768px) {

    /* 隐藏侧边栏 */
    #sidebar {
        display: none;
    }

    /* 顶部导航栏：适配刘海屏安全区域 */
    #top-navbar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    /* 调整欢迎屏 */
    #welcome-screen h1 {
        font-size: 1.5rem;
    }

    #welcome-screen p {
        font-size: 0.875rem;
    }

    /* 调整快捷按钮 */
    #welcome-screen .grid-cols-2 {
        gap: 0.5rem;
    }

    #welcome-screen button {
        padding: 0.75rem;
    }

    /* 调整消息容器：移动端需要更多底部间距，因为输入区更高（模式药丸可能换行） */
    #messages-container {
        padding: 1rem;
        padding-bottom: calc(14rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* 欢迎屏底部间距也要加上安全区域 */
    #welcome-screen {
        padding-bottom: calc(12rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* 调整进度卡片 */
    .log-window {
        display: none;
    }

    #steps-list {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.25rem;
        font-size: 0.65rem;
    }

    #steps-list .w-6 {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.6rem;
    }

    /* 调整结果卡片 */
    #result-card .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    #result-card .flex.gap-3 {
        flex-direction: column;
    }

    /* 调整输入区 */
    #chat-input {
        font-size: 16px;
    }

    /* 消息操作按钮：增大触控区域到 44px (Apple HIG 标准) */
    .msg-action-btn {
        width: 44px;
        height: 44px;
        border-radius: 8px;
    }

    /* 模态框宽度安全约束 */
    .help-modal {
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
    }

    .material-guide-modal {
        width: calc(100vw - 1.5rem);
        max-width: calc(100vw - 1.5rem);
    }

    /* 防止iOS缩放 */
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    #welcome-screen .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    #welcome-screen .suggest-prompt {
        width: 100%;
    }
}

/* 视口高度不足时压缩欢迎页间距 */
@media (max-height: 700px) {
    #welcome-screen {
        padding-top: 1rem;
        padding-bottom: 10rem;
        justify-content: flex-start;
    }

    #welcome-screen h1 {
        margin-bottom: 0.25rem;
    }

    #welcome-screen .logo-float {
        width: 3.5rem !important;
        height: 3.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    #welcome-screen .mb-8 {
        margin-bottom: 1rem;
    }

    #welcome-screen .mb-6 {
        margin-bottom: 0.75rem;
    }

    #welcome-screen .p-5,
    #welcome-screen .p-6 {
        padding: 0.75rem;
    }

    #welcome-screen .p-4 {
        padding: 0.625rem;
    }

    #welcome-screen .gap-3 {
        gap: 0.5rem;
    }
}

/* ========== 移动端触控增强 ========== */
/* 触屏设备：hover 不可靠，用 :active 提供交互反馈 */
@media (hover: none) and (pointer: coarse) {
    .glass-card:active {
        background: rgba(167, 139, 250, 0.06);
        border-color: rgba(167, 139, 250, 0.35);
        transform: scale(0.98);
    }

    .action-btn:active {
        border-color: rgba(167, 139, 250, 0.35);
        transform: scale(0.97);
    }

    .action-btn:active::before {
        opacity: 1;
    }

    .svc-mode-btn:active:not(.disabled) {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(255, 255, 255, 0.2);
    }

    .msg-action-btn:active {
        background: rgba(255, 255, 255, 0.15);
        color: rgba(255, 255, 255, 0.9);
        transform: scale(0.9);
    }

    /* 消息操作按钮始终可见 */
    .message-actions {
        opacity: 0.5;
        pointer-events: auto;
    }
}

/* ========== viewport meta 安全网 ========== */
/* 确保在所有支持 viewport-fit=cover 的设备上正确处理安全区域 */
@supports (padding: env(safe-area-inset-top)) {
    #top-navbar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    #chat-input-area {
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
    }
}