* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 500px;
    height: 95vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    text-align: center;
    padding: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

    .header h1 {
        font-size: 1rem;
        font-weight: 600;
        letter-spacing: 1px;
    }

/* 关键修改：数字形象区域适配所有设备 */
.avatar-container {
    position: relative;
    height: 90vh; /* 默认电脑端高度 */
    max-height: 780px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f0f4f8;
}

.avatar {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* 视频播放器关键样式 */
#myPlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* 加载指示器 */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 20;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 聊天区域 */
.chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fbfd;
    display: flex;
    flex-direction: column;
}

.chat-history {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-message {
    align-self: flex-start;
}

.avatar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6a11cb;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    margin: 0 10px;
    flex-shrink: 0;
}

.message-content {
    padding: 12px 15px;
    border-radius: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: #2575fc;
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message .message-content {
    background: #ffffff;
    color: #333;
    border-bottom-left-radius: 5px;
    border: 1px solid #eee;
}

/* 快速问题样式 */
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    justify-content: center;
}

.quick-question {
    background: rgba(37, 117, 252, 0.1);
    color: #2575fc;
    border: none;
    padding: 8px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

    .quick-question:hover {
        background: rgba(37, 117, 252, 0.2);
        transform: translateY(-2px);
    }

/* 输入区域 */
.footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.input-container {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 30px;
    overflow: hidden;
    background: #f9fbfd;
}

#textInput {
    flex: 1;
    border: none;
    padding: 15px 20px;
    font-size: 1rem;
    outline: none;
    background: transparent;
}

.input-buttons {
    display: flex;
}

.voice-button, .send-button {
    border: none;
    background: transparent;
    padding: 0 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-button {
    font-size: 1.5rem;
    color: #6a11cb;
}

.send-button {
    background: #6a11cb;
    color: white;
    font-weight: 500;
    padding: 0 25px;
    transition: background 0.3s;
}

    .send-button:hover {
        background: #2575fc;
    }

/* 语音输入模式 */
.voice-input-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.hold-to-talk {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: 30px;
    background: #f0f0f0;
    color: #555;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid #ddd;
}

    .hold-to-talk:active {
        background: #e0e0e0;
        transform: scale(0.98);
    }

.cancel-voice {
    background: transparent;
    border: none;
    color: #6a11cb;
    font-weight: 500;
    padding: 10px 15px;
    cursor: pointer;
}

/* 录音UI */
.recording-ui {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 300px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 15px;
    display: none;
    z-index: 100;
}

.recording-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#countdown {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 10px 0;
    color: white;
}

.cancel-hint {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #ff9999;
    display: none;
}

.pulse {
    width: 60px;
    height: 60px;
    background: #ff4d4d;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 15px rgba(255, 77, 77, 0);
    }

    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        padding: 0;
    }

    /* 移动端特定高度 */
    .avatar-container {
        height: 50vh;
        max-height: 600px;
    }

    .chat-container {
        padding: 15px;
    }

    .message-content {
        padding: 10px 12px;
    }
}

/* 临时消息的动画效果 */
@keyframes pulse {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 0.8;
    }
}

.pending-text {
    animation: pulse 1.5s infinite;
}

.message-content {
    transition: all 0.3s ease;
}
