/* AI Voice Assistant - 样式表 */
/* 外语语音实时对话助手 */

:root {
    /* 颜色主题 - 深邃蓝黑配橙红点缀 */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2235;
    --bg-card: #1e2738;
    --bg-hover: #252f42;
    
    --accent-primary: #ff6b35;
    --accent-secondary: #ff8c5a;
    --accent-glow: rgba(255, 107, 53, 0.3);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: #2d3a4f;
    --border-light: #3d4a5f;
    
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* 消息颜色 */
    --msg-counterpart: #2563eb;
    --msg-ai: #7c3aed;
    --msg-user: #059669;
    
    /* 字体 */
    --font-sans: 'Noto Sans SC', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* 尺寸 */
    --header-height: 60px;
    --controls-height: 100px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50px;
    
    /* 动画 */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* 基础样式重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 背景效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(37, 99, 235, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============ 头部 ============ */
.header {
    height: var(--header-height);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.header-left, .header-right {
    width: 48px;
    display: flex;
    justify-content: center;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

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

.btn-icon svg {
    width: 22px;
    height: 22px;
}

/* ============ 主内容 ============ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* ============ 设置界面 ============ */
.setup-container {
    flex: 1;
    padding: 24px 20px;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.setup-header {
    text-align: center;
    margin-bottom: 32px;
}

.setup-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* 表单样式 */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* 密码状态 */
.password-status {
    font-size: 0.85rem;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 4px;
}

.password-status.success {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.password-status.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* API 用量统计 */
.usage-stats {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.usage-loading {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.usage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.usage-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 6px;
}

.usage-item.full-width {
    grid-column: 1 / -1;
}

.usage-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.usage-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.usage-value.cost {
    color: #f59e0b;
}

.usage-section-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 16px 0 8px 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.usage-section-title:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.form-input,
.form-textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition-fast);
    resize: none;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* 语言选择网格 */
.language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.language-option {
    padding: 12px 8px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.language-option:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.language-option.selected {
    border-color: var(--accent-primary);
    background: rgba(255, 107, 53, 0.1);
}

.language-option .native {
    font-size: 1rem;
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.language-option .name {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 场景列表 */
.scenario-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.scenario-option {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.scenario-option:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.scenario-option.selected {
    border-color: var(--accent-primary);
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent-primary);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-large {
    padding: 18px 32px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}

/* ============ 对话界面 ============ */
#conversation-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#conversation-screen.active {
    display: flex;
}

.conversation-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: none;  /* 默认隐藏，JS 控制显示 */
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.conversation-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.language-badge {
    padding: 4px 12px;
    background: var(--msg-counterpart);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.context-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-export {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.btn-end {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-end:hover {
    background: var(--danger);
    color: white;
}

/* 消息容器 */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-top: 70px;     /* 为顶部 header 留空间 */
    padding-bottom: 120px;  /* 为底部控制栏留空间 */
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 消息气泡 */
.message {
    max-width: 85%;
    animation: messageIn 0.3s ease;
}

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

.message-counterpart {
    align-self: flex-start;
}

.message-ai,
.message-assistant {
    align-self: flex-end;
}

.message-user {
    align-self: flex-end;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    position: relative;
}

.message-counterpart .message-bubble {
    background: linear-gradient(135deg, #1e3a5f, #1e2f4a);
    border-bottom-left-radius: 4px;
}

.message-ai .message-bubble,
.message-assistant .message-bubble {
    background: linear-gradient(135deg, #3d1f5c, #2e1a47);
    border-bottom-right-radius: 4px;
}

.message-user .message-bubble {
    background: linear-gradient(135deg, #1a4d3e, #143d32);
    border-bottom-right-radius: 4px;
}

.message-role {
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 6px;
    opacity: 0.8;
}

.message-counterpart .message-role { color: #60a5fa; }
.message-ai .message-role,
.message-assistant .message-role { color: #a78bfa; }
.message-user .message-role { color: #34d399; }
.message-user-input .message-role { color: #f59e0b; }

/* 我的指令消息 - 显示在右侧，与AI消息区分 */
.message-user-input {
    align-self: flex-end;
}

.message-user-input .message-bubble {
    background: linear-gradient(135deg, #4a3728, #3d2e22);
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.message-original {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

.message-translated {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 选项面板 */
.options-panel {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 16px;
    animation: slideUp 0.3s ease;
}

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

.options-header h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.option-btn {
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.option-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.option-btn:active {
    background: rgba(255, 107, 53, 0.1);
}

.custom-input-wrapper {
    display: flex;
    gap: 10px;
}

.custom-input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: inherit;
}

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

.btn-send {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-send:hover {
    background: var(--accent-secondary);
}

.btn-send svg {
    width: 20px;
    height: 20px;
}

/* 对话控制栏 - 固定在底部 */
.conversation-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--controls-height);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    display: none;  /* 默认隐藏，JS 控制显示 */
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 0 20px;
    z-index: 100;
}

.btn-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-control:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-control svg {
    width: 28px;
    height: 28px;
}

.btn-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-record.recording {
    background: var(--danger);
    border-color: var(--danger);
    animation: pulse 1.5s infinite;
}

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

.btn-record.recording .btn-label {
    color: white;
}

/* 音频指示器 */
.audio-indicator {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 40px;
    opacity: 0;
    transition: var(--transition-fast);
}

.audio-indicator.active {
    opacity: 1;
}

.audio-bar {
    width: 4px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: audioWave 0.5s ease-in-out infinite;
}

.audio-bar:nth-child(1) { animation-delay: 0s; }
.audio-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes audioWave {
    0%, 100% { height: 8px; }
    50% { height: 24px; }
}

/* ============ 模态框 ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
}

.modal-large {
    max-height: 90vh;
}

.modal-small {
    max-height: 50vh;
}

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

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

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.btn-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.modal-body h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* 历史记录 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.history-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.history-item-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-item-language {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: var(--msg-counterpart);
    color: white;
    border-radius: var(--radius-full);
}

.history-item-purpose {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.history-item-summary {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* 结果展示 */
.result-summary {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.result-summary h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.result-summary p {
    font-size: 1rem;
    line-height: 1.6;
}

.action-items {
    margin-bottom: 20px;
}

.action-items h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.action-items ul {
    list-style: none;
}

.action-items li {
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.action-items li::before {
    content: '•';
    color: var(--accent-primary);
    font-weight: bold;
}

/* ============ 加载动画 ============ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 2000;
}

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

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

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

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

/* ============ 响应式 ============ */
@media (min-width: 768px) {
    .modal-content {
        border-radius: var(--radius-lg);
        margin-bottom: 5vh;
    }
    
    .setup-container {
        padding: 40px;
    }
    
    .action-buttons {
        flex-direction: row;
    }
    
    .action-buttons .btn {
        flex: 1;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============ 轻量状态提示 ============ */
.processing-status {
    position: fixed;
    top: calc(var(--header-height) + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-secondary);
    z-index: 100;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.processing-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: pulse-dot 1s ease-in-out infinite;
}

.processing-status.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ============ iOS 音频提示 ============ */
.ios-audio-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ios-audio-prompt.active {
    opacity: 1;
    visibility: visible;
}

.ios-prompt-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px 40px;
    text-align: center;
}

.ios-play-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s ease;
}

.ios-play-btn:hover {
    background: var(--accent-secondary);
}

/* ============ 录音状态增强 ============ */
.btn-record.recording {
    background: var(--danger) !important;
    animation: recording-pulse 1.5s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
}

/* 音量条动画增强 */
.audio-indicator.active .audio-bar {
    animation: none;
    transition: transform 0.1s ease;
}

/* ============ 自动录音指示 ============ */
.auto-recording-indicator {
    position: fixed;
    bottom: calc(var(--controls-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auto-recording-indicator.active {
    opacity: 1;
}

.auto-recording-indicator::before {
    content: '';
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: blink 1s ease-in-out infinite;
}

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

/* ============ Realtime 模式样式 ============ */
.realtime-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.btn-control.realtime-active {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    border: none;
    pointer-events: none;
}

.btn-control.realtime-active .realtime-status-icon {
    position: relative;
    width: 24px;
    height: 24px;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: pulse-ring-anim 1.5s ease-out infinite;
}

.pulse-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
}

@keyframes pulse-ring-anim {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.btn-control.user-speaking {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}

.btn-control.user-speaking .btn-label {
    animation: blink 0.5s ease-in-out infinite;
}

/* Realtime 文字输入区域 */
.realtime-input-area {
    padding: 15px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    display: none;  /* 默认隐藏，JS 控制显示 */
}

.realtime-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.realtime-text-input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.realtime-text-input:focus {
    border-color: var(--accent-primary);
}

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

.realtime-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.1s ease;
}

.realtime-send-btn:hover {
    background: var(--accent-secondary);
}

.realtime-send-btn:active {
    transform: scale(0.95);
}

.realtime-send-btn svg {
    width: 20px;
    height: 20px;
}

/* 快捷回复按钮 */
.quick-replies {
    display: none;  /* 默认隐藏，JS 控制显示 */
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.quick-reply-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-reply-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* 打断按钮 */
.interrupt-btn {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--danger);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 100;
}

.interrupt-btn.active {
    opacity: 1;
    visibility: visible;
}

.interrupt-btn:hover {
    background: #dc2626;
}

/* ============ 实时对话选项 ============ */
.realtime-options {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 16px 0;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.realtime-options .options-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.realtime-options .options-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.realtime-options .option-btn {
    background: linear-gradient(135deg, #3d1f5c, #2e1a47);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: #a78bfa;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.realtime-options .option-btn:hover {
    background: linear-gradient(135deg, #4d2f6c, #3e2a57);
    border-color: #a78bfa;
    color: white;
}

.realtime-options .custom-input-row {
    display: flex;
    gap: 8px;
}

.realtime-options .custom-input-row input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.realtime-options .custom-input-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.realtime-options .custom-input-row button {
    background: var(--accent-primary);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.realtime-options .custom-input-row button:hover {
    background: var(--accent-secondary);
}

/* 等待用户输入时的高亮样式 */
.realtime-options.waiting-input {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), var(--bg-card));
}

.realtime-options.waiting-input .options-label {
    color: #f59e0b;
    font-weight: 500;
}

/* 正在识别提示 */
.typing-indicator {
    color: var(--text-secondary);
    font-style: italic;
}

.typing-indicator::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* 设置面板分隔线 */
.settings-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* 语言选择器 */
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* ========================================
   v1.6: 噪音过滤相关样式
   ======================================== */

/* AI说话状态指示 */
.btn-action.ai-speaking {
    animation: ai-speaking-pulse 1s ease-in-out infinite;
}

@keyframes ai-speaking-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
    }
}

/* 打断通知 */
.barge-in-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
}

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

.barge-in-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.barge-in-icon {
    font-size: 1.2rem;
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.barge-in-text {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 噪音过滤调试指示器（可选） */
.noise-filter-indicator {
    position: fixed;
    bottom: 120px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    z-index: 100;
    opacity: 0.7;
    max-width: 200px;
}

.noise-filter-indicator.filtered {
    border-color: var(--warning);
    color: var(--warning);
}

.noise-filter-indicator.barge-in {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ========================================
   消息操作按钮（重播等）
   ======================================== */

.message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-replay {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0.6;
}

.btn-replay:hover {
    opacity: 1;
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.btn-replay:disabled {
    cursor: wait;
    opacity: 0.4;
}

.message-bubble:hover .btn-replay {
    opacity: 0.8;
}

