* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    padding-bottom: 100px; /* 为底部按钮留出空间，减少以消除空白 */
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 130px); /* 减小最小高度以消除空白区域 */
}

/* 优化的头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* 不收缩 */
    min-height: 48px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.logo-icon {
    font-size: 20px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.scenario-label {
    font-size: 13px;
    opacity: 0.9;
}

.scenario-value {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff5252;
    animation: statusPulse 2s infinite;
}

.status-dot.connected {
    background: #4CAF50;
    animation: none;
}

.status-text {
    font-size: 13px;
    font-weight: 500;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 固定在底部的控制按钮 */
.fixed-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 15px;
    padding-bottom: max(15px, env(safe-area-inset-bottom)); /* 适配iPhone刘海屏 */
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    gap: 15px;
}

.btn {
    flex: 1;
    padding: 20px 15px; /* 恢复原始大小 */
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    line-height: 1.4;
    text-align: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

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

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

/* 录音按钮（左侧） */
.btn-record {
    background: linear-gradient(135deg, #2196F3 0%, #1976d2 100%);
    color: white;
    font-size: 15px;
    max-width: 45%;
}

.btn-record:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-record:active:not(:disabled) {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
}

.btn-record.recording {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    animation: recordingPulse 1.5s infinite;
}

/* 连接按钮（右侧） */
.btn-connect {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    font-size: 15px;
    max-width: 45%;
}

.btn-connect:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-connect:active:not(:disabled) {
    background: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
}

.btn-connect:disabled {
    background: linear-gradient(135deg, #81c784 0%, #66bb6a 100%);
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
    }
    50% {
        box-shadow: 0 6px 30px rgba(244, 67, 54, 0.8);
    }
}

/* 消息显示区域 - 扩大占比 */
.messages {
    flex: 1; /* 自动填充剩余空间 */
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fafafa;
    -webkit-overflow-scrolling: touch; /* 移动端平滑滚动 */
    overscroll-behavior-y: contain; /* 仅在消息区域内禁用下拉刷新，防止滚动传播 */
}

/* 消息卡片样式 - 聊天风格 */
.message {
    padding: 12px 14px;
    margin: 8px 0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.3s;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

/* 标签样式：统一的 "标签: 内容" 格式 */
.message strong {
    display: inline;
    margin-right: 4px;
    font-size: 14px;
    font-weight: 600;
}

.message-system {
    background: #e3f2fd;
    border-left: 3px solid #2196F3;
}

.message-system strong {
    color: #1976d2;
}

.message-ai {
    background: #f3e5f5;
    border-left: 3px solid #9c27b0;
}

.message-ai strong {
    color: #7b1fa2;
}

.message-user {
    background: #e8f5e9;
    border-left: 3px solid #4CAF50;
}

.message-user strong {
    color: #388e3c;
}

.message-error {
    background: #ffebee;
    border-left: 3px solid #f44336;
}

.message-error strong {
    color: #c62828;
}

.message-tips {
    background: #fff3e0;
    border-left: 3px solid #ff9800;
}

.message-tips strong {
    color: #f57c00;
}

.message-eva {
    background: #e0f2f1;
    border-left: 3px solid #009688;
}

.message-eva strong {
    color: #00796b;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #757575;
    font-size: 15px;
    line-height: 1.6;
}

/* 评分标签 */
.score {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    background: #4CAF50;
    color: white;
    font-weight: 600;
    font-size: 13px;
    margin: 4px 0;
}

.score.low {
    background: #f44336;
}

.score.medium {
    background: #ff9800;
}

.score.high {
    background: #4CAF50;
}

/* 纠正建议卡片 */
.correction {
    padding: 10px 12px;
    margin: 8px 0 4px 0;
    background: #fffde7;
    border-radius: 6px;
    border-left: 3px solid #fbc02d;
    font-size: 13px;
    line-height: 1.6;
}

.correction strong {
    display: block;
    margin-bottom: 4px;
    color: #f57f17;
}

/* 回复示例列表 */
.examples {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0; /* 减小上边距，修复间距过大问题 */
}

.examples li {
    padding: 8px 10px;
    margin: 6px 0;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 3px solid #2196F3;
    font-size: 13px;
    line-height: 1.5;
}

/* 响应式设计 */

/* 小屏幕（手机） */
@media (max-width: 600px) {
    body {
        padding: 5px;
        padding-bottom: 95px; /* 为底部按钮留出空间 */
    }

    .container {
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .header {
        padding: 10px 12px;
        min-height: 44px;
    }

    .logo-text {
        font-size: 16px;
    }

    .scenario-label,
    .scenario-value,
    .status-text {
        font-size: 12px;
    }

    .header-center {
        padding: 5px 10px;
    }

    .fixed-controls {
        padding: 10px;
        gap: 10px;
    }

    .btn {
        padding: 20px 10px; /* 恢复原始大小 */
        font-size: 14px;
        border-radius: 12px;
    }

    .btn-record,
    .btn-connect {
        max-width: 48%;
    }

    .messages {
        padding: 10px;
    }

    .message {
        padding: 10px 12px;
        margin: 6px 0;
        font-size: 13px;
    }
}

/* 中等屏幕（平板） */
@media (min-width: 601px) and (max-width: 1024px) {
    .container {
        max-width: 700px;
    }

    .fixed-controls {
        max-width: 700px;
        left: 50%;
        transform: translateX(-50%);
    }

    .btn-record,
    .btn-connect {
        max-width: 280px;
    }
}

/* 大屏幕（电脑） */
@media (min-width: 1025px) {
    .container {
        max-width: 800px;
    }

    .fixed-controls {
        max-width: 800px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 15px 15px 0 0;
    }

    .btn-record,
    .btn-connect {
        max-width: 300px;
    }


    /* 电脑端可以显示hover效果 */
    .btn:hover:not(:disabled) {
        transform: translateY(-2px);
    }
}

/* 横屏优化 */
@media (orientation: landscape) and (max-height: 500px) {
    body {
        padding: 5px;
        padding-bottom: 85px;
    }

    .header {
        padding: 8px 12px;
        min-height: 40px;
    }

    .logo-icon {
        font-size: 18px;
    }

    .logo-text {
        font-size: 16px;
    }

    .fixed-controls {
        padding: 10px;
    }

    .btn {
        padding: 18px 10px;
        font-size: 14px;
    }
}


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

.messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

