/* 全局样式 - 移动端优先 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* CSS变量 - 设计令牌系统 */
:root {
    --font-system: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    /* 颜色系统 - 语义化命名 */
    --color-brand-primary: #1e3a8a;
    --color-brand-secondary: #0ea5e9;
    --color-brand-accent: #06b6d4;
    --color-text-primary: #333;
    --color-text-secondary: #666;
    --color-background-primary: #ffffff;
    --color-background-secondary: #f8f9fa;
    --color-background-overlay: rgba(255, 255, 255, 0.95);
    --color-danger-primary: #ef4444;
    --color-danger-secondary: #dc2626;

    /* 渐变系统 */
    --gradient-primary: linear-gradient(135deg, var(--color-brand-primary) 0%, var(--color-brand-secondary) 50%, var(--color-brand-accent) 100%);
    --gradient-header: linear-gradient(135deg, rgba(30, 58, 138, 0.95), rgba(14, 165, 233, 0.95));
    --gradient-surface: linear-gradient(135deg, var(--color-background-primary), #e0f2fe);
    --gradient-avatar-surface: radial-gradient(ellipse at 76% 100%, #c6eaf3 0%, #e1edff 39%, transparent 76%), #fbfdff;
    --gradient-button: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
    --gradient-danger: linear-gradient(135deg, var(--color-danger-primary), var(--color-danger-secondary));

    /* 阴影系统 */
    --shadow-elevation-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-elevation-2: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-elevation-3: 0 10px 25px rgba(0, 0, 0, 0.1), 0 6px 10px rgba(0, 0, 0, 0.05);
    --shadow-header: 0 4px 20px rgba(30, 58, 138, 0.3);
    --shadow-button: 0 2px 8px rgba(102, 126, 234, 0.4);
    --shadow-footer: 0 -4px 20px rgba(14, 165, 233, 0.3);

    /* 间距系统 */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-2xl: 3rem;     /* 48px */

    /* 圆角系统 */
    --radius-xs: 3px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 15px;
    --radius-xl: 18px;
    --radius-2xl: 25px;
    --radius-full: 50%;

    /* 字体系统 */
    --font-size-xs: 0.75rem;   /* 12px */
    --font-size-sm: 0.875rem;  /* 14px */
    --font-size-base: 1rem;    /* 16px */
    --font-size-lg: 1.125rem;  /* 18px */
    --font-size-xl: 1.25rem;   /* 20px */
    --font-size-2xl: 1.5rem;   /* 24px */
    --line-height-tight: 1.25;
    --line-height-base: 1.5;
    --line-height-relaxed: 1.6;

    /* 动画系统 */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
    --easing-ease: ease;
    --easing-ease-in-out: ease-in-out;

    /* 兼容旧变量名 */
    --primary-blue: var(--color-brand-primary);
    --primary-cyan: var(--color-brand-secondary);
    --primary-teal: var(--color-brand-accent);
    --gradient-card: var(--gradient-surface);
    --shadow-card: var(--shadow-elevation-3);
    --bg-white: var(--color-background-primary);
    --bg-gray-light: var(--color-background-secondary);
    --bg-white-transparent: var(--color-background-overlay);
    --line-height: var(--line-height-relaxed);
}

body {
    font-family: var(--font-system);
    background: var(--gradient-primary);
    min-height: 100vh;
    color: #333;
    line-height: var(--line-height);
    overflow-x: hidden;
}

/* 辅助功能样式 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 通知动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* 移动端安全区域适配 */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* 流式消息样式 */
.message.streaming .message-content {
    align-items: flex-start;
}

.streaming-text {
    margin: 0;
    line-height: 1.5;
    /*white-space: pre-wrap;  恢复空白符处理，支持换行显示 */
    word-wrap: break-word;
}

/* 头部样式 - 移动端优化 */
.header {
    background: var(--gradient-header);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    box-shadow: var(--shadow-header);
    /* position: sticky; */
    top: 0;
    z-index: 999;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    position: absolute;
    left: 0;
}

.header-content i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

.header h1 {
    font-size: 1.4rem;
    background: var(--gradient-card);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
    text-align: center;
}

/* 主要内容区 - 移动端优先 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 15px;
    gap: 15px;
    overflow: overlay;
    position: relative;
}

/* 聊天容器 - 移动端优化 */
.chat-container {
    background: var(--bg-white-transparent);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 60vh;
    max-height: 95vh;
    overflow: hidden;
    position: relative;
}

.voice-assistant {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    padding: 6px 18px;
    border-bottom: 1px solid #d5e5f1;
    background: var(--gradient-avatar-surface);
}

.voice-assistant-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
    color: #142943;
}

.voice-assistant-copy strong {
    font-size: 1rem;
    font-weight: 650;
}

.voice-assistant-copy span {
    font-size: 0.78rem;
    color: #52647a;
}

.chat-stage {
    position: relative;
    isolation: isolate;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #fbfdff;
}

.chat-stage::before {
    position: absolute;
    inset: 8% -7% 0 30%;
    content: '';
    pointer-events: none;
    background: radial-gradient(ellipse at 64% 58%, #b8e7f1 0%, #dfebff 36%, transparent 72%);
    filter: blur(24px);
    opacity: 0.7;
}

.voice-avatar {
    --avatar-turn: 1.15deg;
    --avatar-shift: 1px;
    position: absolute;
    right: 3%;
    bottom: 3%;
    width: auto;
    height: 94%;
    max-width: 40%;
    max-height: 480px;
    aspect-ratio: 3 / 4;
    opacity: 0.9;
    pointer-events: none;
    transition: right 260ms ease, height 260ms ease, opacity 240ms ease;
}

.voice-avatar.is-speaking {
    opacity: 1;
}

.chat-container:has(.voice-avatar.is-speaking) .voice-assistant-copy span {
    color: #006b87;
}

.voice-avatar-art,
.voice-avatar-moving {
    position: absolute;
    inset: 0;
}

.voice-avatar-art {
    transform-origin: center bottom;
}

.voice-avatar-moving {
    transform-origin: 52.1% 59.8%;
}

@media (prefers-reduced-motion: no-preference) {
    .chat-container:not(:has(.message.user, #userInput:not(:placeholder-shown), #voiceRecordBtn[aria-pressed="true"], #typing-indicator))
        .voice-avatar:not(.is-speaking, .is-motion-paused) .voice-avatar-art {
        animation: avatar-breathe 4.8s ease-in-out infinite;
    }

    .voice-avatar.is-speaking:not(.is-motion-paused) .voice-avatar-moving {
        animation: avatar-gesture 5.2s ease-in-out infinite;
    }
}

@keyframes avatar-breathe {
    50% { transform: scaleY(1.003); }
}

@keyframes avatar-gesture {
    25% { transform: translateX(var(--avatar-shift)) rotate(var(--avatar-turn)); }
    75% { transform: translateX(calc(-1 * var(--avatar-shift))) rotate(calc(-0.8 * var(--avatar-turn))); }
}

.voice-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
}

.voice-avatar-overlay {
    opacity: 0;
    transition: opacity 80ms ease-out;
}

.voice-avatar-overlay.is-visible {
    opacity: 1;
}

@media (min-width: 1025px) and (pointer: fine) {
    .chat-stage .message.assistant .message-content {
        max-width: 62%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .voice-avatar,
    .voice-avatar-overlay {
        transition: none;
    }
}

.voice-record-btn,
.send-btn,
.voice-mute-btn,
.clear-btn {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #374151;
    font: inherit;
    cursor: pointer;
    user-select: none;
    -webkit-touch-callout: none;
}

.voice-record-btn {
    touch-action: none;
}

.voice-record-btn:hover,
.voice-mute-btn:hover,
.clear-btn:hover {
    background: #e9edf3;
}

.voice-record-icon {
    font: 900 1rem "Font Awesome 6 Free";
}

.voice-record-icon::before {
    content: "\f130";
}

.voice-record-btn[aria-pressed="true"] .voice-record-icon::before {
    content: "\f04d";
}

.voice-record-btn[aria-pressed="true"] {
    color: #155eef;
    background: #e8f1ff;
}

.send-btn {
    width: 34px;
    height: 34px;
    margin: 3px 0;
    background: #175cd3;
    color: #fff;
}

.voice-assistant-actions {
    display: flex;
    margin-left: auto;
    gap: 8px;
}

.voice-assistant-actions button {
    border: 1px solid #c7dbea;
    background: #fafdff;
    color: #34536d;
    box-shadow: 0 2px 5px rgb(36 70 109 / 12%);
}

.voice-assistant-actions button:hover {
    background: #edf6ff;
}

.voice-assistant-actions button:focus-visible {
    outline: 2px solid #3678b3;
    outline-offset: 2px;
}

.voice-assistant-actions .voice-mute-btn[aria-pressed="true"] {
    border-color: #a9c8e2;
    color: #235884;
    background: #e0effc;
}

.clear-btn {
    font-size: 0.9rem;
}

.voice-record-btn:disabled,
.send-btn:disabled,
.clear-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.voice-composer-field {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
}

.voice-hold-overlay:not([hidden]) {
    position: fixed;
    z-index: 1100;
    inset: auto 0 0;
    display: grid;
    justify-items: center;
    align-content: end;
    gap: 24px;
    min-height: clamp(190px, 30dvh, 290px);
    padding: 52px 24px calc(38px + env(safe-area-inset-bottom));
    color: #fff;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 10% 100%, #00b5ff 0%, transparent 65%),
        linear-gradient(180deg, transparent 0%, #0c8ff7 48%, #0750f5 100%);
}

.voice-hold-overlay.is-cancelling {
    background: linear-gradient(180deg, transparent, #ed6972 52%, #c52e45);
}

.voice-hold-overlay p {
    font-size: 0.94rem;
    font-weight: 600;
    text-shadow: 0 1px 4px #0b397866;
}

.voice-waveform:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(2px, 0.65vw, 4px);
    height: 30px;
}

.voice-composer-field .voice-waveform:not([hidden]) {
    position: absolute;
    inset: 0;
    height: auto;
    border-radius: 14px;
    background: #f5f7fb;
    color: #175cd3;
}

.voice-waveform span {
    width: clamp(2px, 0.7vw, 4px);
    height: 23px;
    border-radius: 3px;
    background: currentColor;
    transform: scaleY(0.22);
    animation: voice-wave 480ms ease-in-out infinite alternate;
}

.voice-waveform span:nth-child(3n) { animation-delay: -320ms; }
.voice-waveform span:nth-child(4n) { animation-delay: -150ms; }
.voice-waveform span:nth-child(5n) { animation-delay: -470ms; }

@keyframes voice-wave {
    to { transform: scaleY(0.95); }
}

@media (prefers-reduced-motion: reduce) {
    .voice-waveform span { animation: none; }
    .voice-waveform span:nth-child(3n) { transform: scaleY(0.75); }
    .voice-waveform span:nth-child(4n) { transform: scaleY(0.5); }
}

.voice-play-btn {
    align-self: flex-start;
    margin: 5px 0 0;
    padding: 3px 10px;
    font-size: 0.75rem;
    border: 1px solid #dbe8fa;
    border-radius: 8px;
    background: #eff6ff;
    color: #175cd3;
    cursor: pointer;
}

.voice-play-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

#voiceInputStatus:not([hidden]) {
    display: block;
    color: #1e40af;
}

/* 聊天消息区域 - 移动端优化 */
.chat-messages {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 15px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.message.user {
    justify-content: flex-end;
}

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

.message-content {
    display: flex;
    min-width: 0;
    max-width: 86%;
}

.message-content p {
    background: var(--bg-gray-light);
    padding: 6px 8px;
    border-radius: var(--radius-xl);
    margin: 0;
    word-wrap: break-word;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap; /* 确保段落中的换行正确显示 */
}

.message.assistant .message-content > :is(p, .streaming-text) {
    min-width: 0;
    padding: 10px 13px;
    border: 1px solid rgb(255 255 255 / 58%);
    border-radius: 16px 16px 16px 5px;
    background: linear-gradient(110deg, rgb(255 255 255 / 52%), rgb(255 255 255 / 26%));
    color: #172538;
    overflow-wrap: anywhere;
}

.message.assistant .streaming-text p {
    padding: 0;
    background: transparent;
}

.message.user .message-content p {
    padding: 7px 12px;
    border: 1px solid rgb(99 152 221 / 22%);
    border-radius: 16px 16px 5px 16px;
    background: rgb(215 233 255 / 67%);
    color: #123b69;
    overflow-wrap: anywhere;
}

.message.assistant .streaming-text :is(ul, ol) {
    margin: 0.4em 0;
    padding-inline-start: 1.2em;
}

/* 快捷问题区域 - 横向滚动优化 */
.chat-controls {
    flex-shrink: 0;
    border-top: 1px solid #d5e5f1;
    background: var(--gradient-avatar-surface);
}

.quick-questions {
    padding: 10px 16px 6px;
}

.quick-questions-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.quick-questions h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #526982;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.quick-heading-mark {
    color: #6294c6;
    font-size: 16px;
}

.quick-buttons-container {
    position: relative;
    min-width: 0;
}

.quick-buttons-container::before,
.quick-buttons-container::after {
    content: '';
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    width: 24px;
    opacity: 0;
    pointer-events: none;
}

.quick-buttons-container::before {
    left: 0;
    background: linear-gradient(90deg, #f0f7fc, #f0f7fc00);
}

.quick-buttons-container::after {
    right: 0;
    background: linear-gradient(270deg, #e7f3fa, #e7f3fa00);
}

.quick-buttons-container[data-left="true"]::before,
.quick-buttons-container[data-right="true"]::after { opacity: 1; }

.quick-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 1px 5px;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}

.quick-buttons::-webkit-scrollbar { display: none; }
.quick-buttons.is-dragging,
.quick-buttons.is-dragging .quick-btn { cursor: grabbing; }

.quick-btn {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 224px;
    padding: 10px 15px;
    border: 1px solid #bfd3e580;
    border-radius: 12px;
    background: #ffffffb8;
    color: #385b7e;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

@media (hover: hover) {
    .quick-btn:hover {
        background: #fff;
        border-color: #80afd8;
        color: #175e9e;
        box-shadow: 0 2px 7px #2354810d;
    }
}

.quick-btn:active { background: #e8f2fc; }
.quick-btn:focus-visible,
.quick-buttons:focus-visible {
    outline: 2px solid #4389ca;
    outline-offset: 2px;
}

.quick-question-tooltip {
    position: fixed;
    z-index: 10000;
    max-width: min(300px, calc(100vw - 24px));
    padding: 8px 12px;
    border: 1px solid #ffffff29;
    border-radius: 10px;
    background: #1f3e60;
    box-shadow: 0 6px 20px #1a3a5c26;
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
    overflow-wrap: anywhere;
    pointer-events: none;
}

.quick-question-tooltip::after {
    content: '';
    position: absolute;
    left: var(--arrow-x);
    bottom: -4px;
    width: 7px;
    height: 7px;
    background: #1f3e60;
    transform: rotate(45deg);
}

.quick-question-tooltip[data-below="true"]::after { top: -4px; bottom: auto; }


/* 消息输入栏 */
.chat-input-container {
    padding: 8px 16px 14px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    min-height: 52px;
    padding: 5px 8px 5px 12px;
    border: 1px solid #e4e7ed;
    border-radius: 22px;
    background: #fafdff;
    box-shadow: 0 3px 12px #172b4d0a;
}

.input-wrapper:focus-within {
    border-color: #b2c8ee;
}

#userInput {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    max-height: 120px;
    padding: 8px 3px;
    border: 0;
    outline: none;
    background: transparent;
    color: #182230;
    font: inherit;
    font-size: 1rem;
    line-height: 24px;
    resize: none;
    scrollbar-width: none;
}

#userInput::placeholder {
    color: #697586;
}

.voice-input-status {
    margin: 6px 4px 0;
    font-size: 0.75rem;
    color: #475467;
}

/* 为移动端添加更好的虚拟键盘适配 */
@media (max-height: 600px) {
    .chat-container {
        max-height: 60vh;
    }

    .header {
        padding: 10px 15px;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .header-content i {
        font-size: 1.5rem;
    }
}


/* 底部 - 移动端优化 */
.footer {
    padding: 15px;
    text-align: center;
    flex-shrink: 0;
    margin-top: auto;
}

.footer-content p {
    margin-bottom: 8px;
    color: #f4f9ff;
    font-size: 0.85rem;
    font-weight: 500;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: var(--transition-base);
    font-size: 0.85rem;
    touch-action: manipulation;
    padding: 4px 8px;
    border-radius: 4px;
}

.footer-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.footer-links a:active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.streaming-text img {
    max-width: 100%;
}

/* 打字动画效果 */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 15px 20px;
    background: var(--bg-gray-light);
    border-radius: var(--radius-xl);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #667eea;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

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

/* 任务进度指示器样式 */
.task-progress {
    /* margin: 15px 0; */
    /* padding: 12px 16px; */
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    /* border-left: 4px solid var(--color-brand-secondary); */
    /* border-radius: var(--radius-lg); */
    box-shadow: var(--shadow-elevation-1);
    animation: slideInRight 0.3s ease-out;
}

.progress-content {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--color-brand-secondary);
    flex-shrink: 0;
}

.progress-icon i {
    font-size: 14px;
}

.progress-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.progress-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--color-text-primary);
    border: 1px solid rgba(14, 165, 233, 0.2);
    transition: all 0.2s ease;
}

.progress-step.active {
    background: var(--color-brand-secondary);
    color: white;
    border-color: var(--color-brand-secondary);
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.3);
}

.progress-step.completed {
    background: rgba(34, 197, 94, 0.1);
    color: rgba(34, 197, 94, 0.9);
    border-color: rgba(34, 197, 94, 0.2);
}

.progress-step-pending {
    background: rgba(255, 255, 255, 0.4);
    color: var(--color-text-secondary);
    border-color: rgba(0, 0, 0, 0.1);
    font-style: italic;
}

.progress-arrow {
    color: var(--color-text-secondary);
    font-size: 10px;
    margin: 0 -2px;
}

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

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

/* 移动端适配任务进度指示器 */
@media (max-width: 768px) {
    .task-progress {
        margin: 10px 0;
        padding: 10px 12px;
    }

    .progress-content {
        gap: 10px;
    }

    .progress-text {
        gap: 4px;
    }

    .progress-steps {
        gap: 6px;
    }

    .progress-step {
        padding: 3px 8px;
        font-size: 11px;
    }

    .progress-arrow {
        font-size: 8px;
        margin: 0 -1px;
    }
}

/* 消息动画增强 */
.message {
    margin-bottom: 20px;
    display: flex;
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* 隐藏滚动条 */
.chat-messages::-webkit-scrollbar {
    display: none;
}

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

/* 虚拟键盘状态处理 */
body.keyboard-open .footer {
    /* 键盘开启时，footer可以被遮挡 */
    position: relative;
    z-index: 1;
}

body.keyboard-open .container {
    /* 键盘开启时，确保容器不会被压缩 */
    min-height: 100vh;
}

/* 移动端优先的响应式设计 */

/* 超小屏设备 (iPhone SE等) */
@media (max-width: 374px) {
    .header {
        padding: 10px 15px;
    }

    .header-content {
        justify-content: flex-start;
        gap: 10px;
    }

    .header-logo {
        position: static;
        height: 32px;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .header-content i {
        font-size: 1.4rem;
        gap: 10px;
    }

    .subtitle {
        font-size: 0.8rem;
        text-align: left;
        flex: 1;
    }



    .info-container {
        flex-direction: column;
        gap: 8px;
    }

    .main-content {
        padding: 10px;
        gap: 10px;
    }
}

/* 小屏设备 (大多数手机竖屏) */
@media (max-width: 480px) {
    .header-logo {
        height: 36px;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .chat-container {
        border-radius: var(--radius-md);
    }

    /* 移动端图片优化 */
    .message-content p.markdown img {
        max-width: 100%; /* 相对于视窗宽度，避免超出 */
        height: auto;
    }

    /* 确保消息内容在小屏幕上不会溢出 */
    .message-content {
        max-width: 86%;
        overflow-x: hidden;
    }
}

/* 横屏模式和大屏手机 */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 8px 15px;
    }

    .header-content i {
        font-size: 1.3rem;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .chat-container {
        max-height: 65vh;
    }

    .main-content {
        padding: 10px;
    }



    .scroll-indicator {
        display: none; /* 横屏模式下隐藏滚动提示 */
    }
}

/* 平板设备横屏 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 768px;
        margin: 0 auto;
    }

    .main-content {
        flex-direction: row;
        gap: 20px;
        padding: 20px;
    }

    .info-container {
        flex: 0 0 300px;
        flex-direction: column;
        gap: 15px;
    }

    .chat-container {
        flex: 1;
        min-height: 600px;
    }



    .scroll-indicator {
        display: none; /* 大屏设备隐藏滚动提示 */
    }
}

/* 大屏设备 */
@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }

    .main-content {
        flex-direction: row;
        gap: 20px;
        padding: 20px;
    }

    .info-container {
        flex: 0 0 350px;
        flex-direction: column;
        gap: 20px;
    }

    .chat-container {
        flex: 1;
        min-height: 600px;
    }

    .header {
        padding: 20px 0;
    }

    .header-content i {
        font-size: 2.5rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }



    .info-card-content p,
    .info-card-content li {
        font-size: 1rem;
    }

    .footer-links a {
        font-size: 1rem;
    }
}

@media (max-width: 600px), (pointer: coarse) {
    body {
        background: #fff;
    }

    .container {
        height: 100dvh;
    }

    .header {
        padding: 8px 14px;
        box-shadow: none;
    }

    .header-content {
        justify-content: space-between;
        gap: 12px;
    }

    .header-logo {
        position: static;
        height: 32px;
    }

    .subtitle {
        flex: none;
        font-style: normal;
        font-weight: 600;
    }

    .main-content {
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }

    .chat-container {
        min-width: 0;
        min-height: 0;
        max-height: none;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }

    .voice-assistant {
        gap: 11px;
        padding: 8px 12px;
    }

    .chat-stage .voice-avatar {
        --avatar-turn: 0.7deg;
        --avatar-shift: 0.6px;
        right: 17%;
        bottom: 2%;
        height: 68%;
        max-width: 66%;
        opacity: 0.95;
    }

    .chat-stage:has(.message.user) .voice-avatar {
        right: 2%;
        height: 62%;
        max-width: 56%;
        opacity: 0.62;
    }

    .chat-stage:has(.message.user) .voice-avatar.is-speaking {
        opacity: 0.86;
    }

    .chat-stage::before {
        inset: 16% 0 -4%;
    }

    .chat-messages {
        padding: 14px;
    }

    .quick-questions {
        padding: 5px 12px;
    }

    .quick-questions-heading {
        display: none;
    }

    .quick-questions h3 {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .quick-buttons {
        padding-bottom: 0;
    }

    .quick-btn {
        min-width: 0;
        max-width: none;
        padding: 7px 11px;
        border: 1px solid #e3e7ee;
        border-radius: 10px;
        color: #344054;
        font-size: 0.8rem;
    }

    .chat-input-container {
        padding: 6px 12px 8px;
    }

    .input-wrapper:has(#userInput:placeholder-shown) .send-btn:not(.is-generating) {
        display: none;
    }

    .voice-record-btn {
        width: 44px;
        height: 44px;
        margin: -2px 0;
    }

    .footer {
        padding: 3px 12px calc(5px + env(safe-area-inset-bottom));
        background: var(--gradient-avatar-surface);
    }

    .footer-content p {
        display: inline;
        margin: 0;
        color: #667085;
        font-size: 0.62rem;
    }
}

/* Keep cancellation available while the empty composer is generating. */
.send-btn.is-generating i {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: currentColor;
}
.send-btn.is-generating i::before { content: none; }
