* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    background-color: #fff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    transform: translateX(-290px);
}

.toggle-button {
    position: absolute;
    right: -30px;
    top: 10px;
    width: 30px;
    height: 30px;
    background-color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.toggle-button:hover {
    background-color: #f0f0f0;
}

.sidebar-content {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.main-content {
    flex: 1;
    margin-left: 300px;
    padding: 20px;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 10px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

h2 {
    margin-top: 20px;
    margin-bottom: 15px;
    color: #2c3e50;
}

h3 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #34495e;
}

.status-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.status-light {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ccc;
    margin-bottom: 5px;
}

.status-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.status-row .status-light {
    margin-right: 10px;
    margin-bottom: 0;
}

#threshold-display {
    margin-top: 5px;
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 4px;
    font-size: 0.9em;
}

#volume-display {
    margin-top: 5px;
    padding: 5px;
    border-radius: 4px;
    font-size: 0.9em;
    transition: color 0.3s;
}

.status-light.listening {
    background-color: #2ecc71;
    box-shadow: 0 0 10px #2ecc71;
}

.status-light.speaking {
    background-color: #e74c3c;
    box-shadow: 0 0 10px #e74c3c;
}

.status-text {
    font-weight: bold;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: fixed;
    top: 240px;
    right: 20px;
    z-index: 1000;
}

@media (max-width: 600px) {
    .controls {
        top: 160px;
        margin-top: 40px;
    }
}

.button {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    margin: 0 5px;
}

.button:hover {
    background-color: #2980b9;
}

.button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.hidden {
    display: none;
}

.conversation-container {
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    scroll-behavior: smooth;
}

.conversation {
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 4px;
    max-width: 80%;
}

.user-message {
    align-self: flex-end;
    background-color: #3498db;
    color: white;
}

.assistant-message {
    align-self: flex-start;
    background-color: #f1f1f1;
}

.settings-container {
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.settings-note {
    color: #ff4444;
    font-weight: bold;
    margin-bottom: 10px;
}

input:disabled {
    background-color: #f0f0f0;
    color: #666;
    cursor: not-allowed;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.avatar-container {
    position: fixed;
    right: 50px;
    bottom: 50px;
    width: 200px;
    height: 200px;
    z-index: 1500;
    transition: all 0.3s ease;
}

/* 当应用处于运行状态时，将头像居中显示并放大 */
body:has(.status-light.listening) .avatar-container,
body:has(.status-light.speaking) .avatar-container {
    right: 50%;
    bottom: 50%;
    transform: translate(50%, 50%);
    width: 600px;
    height: 600px;
}

.avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.avatar-container.speaking img {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.animation-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    display: none;
}

.animation-container.active {
    display: block;
}

.wave-animation-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    display: none;
    z-index: 2000;
}

.wave-animation-container.active {
    display: block;
}

.wave-animation {
    position: relative;
    width: 100%;
    height: 100%;
}

.wave {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid #3498db;
    border-radius: 50%;
    opacity: 0;
    animation: wave 2s infinite;
}

.wave:nth-child(2) {
    animation-delay: 0.5s;
}

.wave:nth-child(3) {
    animation-delay: 1s;
}

@keyframes wave {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

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

.wave-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #3498db;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 600px) {

    /* 侧边栏调整 */
    .sidebar {
        width: 260px;
    }

    .sidebar.collapsed {
        transform: translateX(-250px);
    }

    /* 主内容区域调整 */
    .main-content {
        margin-left: 260px;
        padding-top: 140px;
        /* 增加顶部内边距，为固定定位的元素腾出更多空间 */
        padding-bottom: 220px;
        /* 增加底部内边距，为头像腾出空间 */
    }

    .main-content.expanded {
        margin-left: 10px;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* 调整标题样式 */
    h1 {
        font-size: 20px;
        margin-bottom: 80px;
        /* 增加底部间距，避免与按钮重叠 */
        position: fixed;
        top: 10px;
        left: 0;
        right: 0;
        z-index: 999;
        background-color: #f5f5f5;
        padding: 15px 0;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    /* 调整状态容器位置 */
    .status-container {
        top: 70px;
        right: 10px;
        max-width: 150px;
        font-size: 0.9em;
    }

    /* 调整控制按钮位置 */
    .controls {
        top: 140px;
        right: 10px;
        flex-direction: column;
        gap: 15px;
    }

    .button {
        padding: 10px 16px;
        font-size: 16px;
        margin: 0;
        width: 120px;
    }

    /* 调整消息样式 */
    .message {
        max-width: 90%;
        font-size: 14px;
    }

    /* 调整对话容器 */
    .conversation-container {
        max-height: 200px;
    }

    /* 手机端访问时，调整头像位置和大小 */
    .avatar-container {
        right: 50%;
        bottom: 20px;
        transform: translateX(50%);
        width: 150px;
        height: 150px;
    }

    body:has(.status-light.listening) .avatar-container,
    body:has(.status-light.speaking) .avatar-container {
        right: 50%;
        bottom: 50px;
        transform: translateX(50%);
        width: 200px;
        height: 200px;
    }

    /* 调整波浪动画容器 */
    .wave-animation-container {
        width: 200px;
        height: 200px;
    }

    .wave-text {
        font-size: 14px;
    }
}

.conversation-title {
    font-size: 1.5em;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}