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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.upload-section, .connection-info, .audio-controls, .status {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 5px;
}

input[type="file"], input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin: 0.5rem;
    transition: background-color 0.3s;
}

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

audio {
    width: 100%;
    margin: 0;
}

#connectionStatus {
    font-weight: bold;
    color: #e74c3c;
}

#connectionStatus.connected {
    color: #27ae60;
}

h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

#localId {
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 1rem;
    word-break: break-all;
}

.mode-selection {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-selection button {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    background-color: #3498db;
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-selection button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.code-display {
    font-size: 2rem;
    text-align: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
    font-family: monospace;
    letter-spacing: 3px;
    color: #2c3e50;
    border: 2px dashed #3498db;
}

.panel {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.panel.active {
    opacity: 1;
}

.audio-capture {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.audio-capture button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    background-color: #2ecc71;
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.audio-capture button:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
}

.invite-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.copy-btn {
    padding: 5px 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.copy-btn:hover {
    background-color: #45a049;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 128px;
    background: white;
    padding: 10px;
    border-radius: 4px;
}

#qrcode img {
    display: block;
    max-width: 100%;
    height: auto;
}

.join-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.manual-input, .scan-input {
    width: 100%;
}

#qr-reader {
    width: 100%;
    max-width: 300px;
    margin: 0 auto 15px;
}

#qr-reader video {
    width: 100% !important;
    border-radius: 8px;
}

/* 在移动端显示扫描按钮，在桌面端隐藏 */
@media (min-width: 768px) {
    .scan-input {
        display: none;
    }
}

.host-features {
    margin-top: 20px;
    padding: 15px;
    border-top: 1px solid #eee;
}

.connection-info {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 30px;
}

/* 优化连接状态显示 */
.status {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

/* 添加连接成功后的动画效果 */
.connected-features {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.connected-features.show {
    opacity: 1;
    transform: translateY(0);
}

/* 优化 audio-controls 样式 */
.audio-controls {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 5px;
}

/* 邀请码区域样式 */
.invite-section {
    text-align: center;
    margin-bottom: 24px;
}

.code-display {
    font-size: 2.5rem;
    font-weight: bold;
    text-align: center;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 12px;
    margin: 16px 0;
    font-family: monospace;
    letter-spacing: 4px;
    color: #2c3e50;
    border: 2px dashed #3498db;
    user-select: all; /* 方便用户选择 */
}

/* 分隔线 */
.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
    margin: 24px 0;
}

/* 二维码区域样式 */
.qr-section {
    text-align: center;
}

#qrcode {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin: 16px auto;
}

/* 标题样式优化 */
.connection-info h2 {
    color: #2c3e50;
    font-size: 1.25rem;
    margin-bottom: 16px;
    text-align: center;
}

/* 复制按钮样式优化 */
.copy-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin: 0 auto;
    display: block;
}

.copy-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

/* 响应式调整 */
@media (min-width: 768px) {
    .connection-info {
        padding: 32px;
    }
    
    .code-display {
        font-size: 3rem;
        letter-spacing: 6px;
    }
}

/* 验证码输入框样式 */
.code-input-section {
    margin: 24px 0;
}

.code-input-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

.code-input {
    width: 40px;
    height: 48px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 24px;
    text-align: center;
    font-family: monospace;
    background: #f8f9fa;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.code-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

.code-input.filled {
    border-color: #2ecc71;
    background-color: #f0fff4;
}

/* 扫描按钮样式优化 */
.scan-input button {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.scan-input button:before {
    content: "📷";
}

/* 移动端适配 */
@media (max-width: 480px) {
    .code-input {
        width: 36px;
        height: 42px;
        font-size: 20px;
    }
    
    .code-input-container {
        gap: 8px;
    }
}

/* 主机功能按钮样式 */
.feature-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.feature-button {
    flex: 1;
    max-width: 200px;
}

/* 统一按钮基础样式 */
.upload-btn, .capture-btn {
    width: 100%;
    height: 160px; /* 统一固定高度 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0; /* 移除内边距，使用固定高度 */
    margin: 0; /* 移除外边距 */
    gap: 16px;
    box-sizing: border-box; /* 确保边框不会影响总宽度 */
}

/* 重置按钮默认样式 */
.capture-btn {
    font: inherit; /* 继承字体样式 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.feature-button .icon {
    font-size: 48px; /* 增大图标尺寸 */
    line-height: 1;
    display: block;
}

.feature-button .text {
    font-size: 16px;
    color: #2c3e50;
    text-align: center;
    font-weight: 500;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

/* 修改按钮悬停效果 */
.upload-btn:hover {
    border-color: #ff9f43; /* 橙色边框 */
    background-color: #fff8f0; /* 浅橙色背景 */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 159, 67, 0.15);
}

.capture-btn:hover {
    border-color: #2ecc71; /* 绿色边框 */
    background-color: #f0fff4; /* 浅绿色背景 */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.15);
}

/* 修改按钮激活状态 */
.upload-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(255, 159, 67, 0.1);
    background-color: #fff4e6; /* 更深的橙色背景 */
}

.capture-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(46, 204, 113, 0.1);
    background-color: #e8f8f1; /* 更深的绿色背景 */
}

/* 修改图标颜色过渡 */
.feature-button .icon {
    font-size: 48px;
    line-height: 1;
    display: block;
    transition: all 0.3s ease;
}

/* 悬停时图标颜色变化 */
.upload-btn:hover .icon {
    color: #ff9f43; /* 橙色图标 */
}

.capture-btn:hover .icon {
    color: #2ecc71; /* 绿色图标 */
}

/* 悬停时文字颜色变化 */
.upload-btn:hover .text {
    color: #ff9f43;
}

.capture-btn:hover .text {
    color: #2ecc71;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .feature-buttons {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .feature-button {
        width: 100%;
        max-width: none;
    }
    
    .upload-btn, .capture-btn {
        height: 140px; /* 移动端稍微降低高度 */
    }
    
    .feature-button .icon {
        font-size: 36px;
    }
    
    .feature-button .text {
        font-size: 15px;
    }
}

/* 添加动画效果 */
.feature-button {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.feature-button:nth-child(2) {
    animation-delay: 0.1s;
}

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

.manual-calibration {
    margin: 10px 0;
    text-align: center;
}

.manual-calibration input[type="number"] {
    width: 80px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #4CAF50;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
    color: #4CAF50;
    margin: 0 10px;
}

.manual-calibration input[type="number"]:focus {
    outline: none;
    border-color: #45a049;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.manual-calibration button {
    padding: 5px 15px;
    height: 30px;
    border: none;
    border-radius: 4px;
    background-color: #4CAF50;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.manual-calibration button:hover {
    background-color: #45a049;
}

.manual-calibration button:active {
    background-color: #3d8b40;
}

#manualLatency {
    display: inline-block;
    min-width: 40px;
    font-weight: bold;
    color: #4CAF50;
}

.devices-list {
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.devices-list h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.1em;
}

.device-info {
    padding: 12px;
    margin: 8px 0;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #eee;
}

.device-info.active {
    border-left: 4px solid #4CAF50;
}

.device-header {
    margin-bottom: 8px;
    color: #2c3e50;
}

.device-calibration {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.manual-latency-input {
    width: 80px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #4CAF50;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
    color: #4CAF50;
}

.manual-latency-input:focus {
    outline: none;
    border-color: #45a049;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.apply-latency-btn {
    padding: 5px 15px;
    height: 30px;
    border: none;
    border-radius: 4px;
    background-color: #4CAF50;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apply-latency-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

.apply-latency-btn:active {
    background-color: #3d8b40;
    transform: translateY(0);
}

.play-control {
    margin: 10px 0;
    text-align: center;
}

.play-btn {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.play-btn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

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

.play-btn .icon {
    font-size: 20px;
}

.play-btn.playing {
    background-color: #e74c3c;
}

.play-btn.playing .icon {
    content: "⏸";
} 