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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 视频区域 */
.video-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
}

/* 音频状态显示 */
.audio-status {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

.status-indicator {
    font-size: 1.2rem;
    font-weight: bold;
}

.status-indicator.connected {
    color: #90EE90;
}

.status-indicator.disconnected {
    color: #FFB6C1;
}

/* 录制视频区域 */
.recorded-video-section {
    margin-bottom: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* 确保视频区域固定高度并居中 */
    min-height: 100vh;
    max-height: 100vh;
    width: 100%;
}

.recorded-video-section h3 {
    margin-bottom: 15px;
    color: #333;
}

#recordedVideo {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    object-fit: cover; /* 覆盖整个容器 */
    background: transparent; /* 透明背景 */
    transition: opacity 0.15s; /* 添加透明度过渡效果 */
    margin: 0 auto; /* 左右居中 */
    display: block; /* 确保块级显示 */
    /* 确保视频始终居中 */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* 视频加载时的样式 */
#recordedVideo.loading {
    opacity: 0.8;
}

/* 视频播放时的样式 */
#recordedVideo.playing {
    opacity: 1;
}

/* 隐藏视频播放条 */
#recordedVideo::-webkit-media-controls {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-panel {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-play-button {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-timeline {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-current-time-display {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-time-remaining-display {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-mute-button {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-volume-slider {
    display: none !important;
}

#recordedVideo::-webkit-media-controls-fullscreen-button {
    display: none !important;
}

/* Firefox 隐藏播放条 */
#recordedVideo::-moz-media-controls {
    display: none !important;
}

/* 通用隐藏播放条 */
#recordedVideo {
    pointer-events: none; /* 禁用鼠标事件，防止用户点击播放条 */
}

.video-info {
    margin-top: 10px;
    font-weight: bold;
    color: #666;
}

/* 控制按钮 */
.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #1e7e34;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
    transform: translateY(-2px);
}

/* 输入区域 */
.input-section {
    margin-bottom: 30px;
}

.text-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#textInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#textInput:focus {
    outline: none;
    border-color: #007bff;
}

.voice-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

#voiceStatus {
    color: #666;
    font-style: italic;
}

/* 视频选择 */
.video-selection {
    margin-bottom: 30px;
}

.video-selection h3 {
    margin-bottom: 15px;
    color: #333;
}

.video-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.video-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.video-item:hover {
    border-color: #007bff;
    background: #e3f2fd;
    transform: translateY(-2px);
}

.video-item.active {
    border-color: #007bff;
    background: #007bff;
    color: white;
}

/* 状态显示 */
.status-section {
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.status {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-weight: bold;
}

.status.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-log {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    font-family: monospace;
    font-size: 0.9rem;
    border: 1px solid #e9ecef;
}

.message-log div {
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 3px;
}

.message-log .info {
    background: #d1ecf1;
    color: #0c5460;
}

.message-log .error {
    background: #f8d7da;
    color: #721c24;
}

.message-log .success {
    background: #d4edda;
    color: #155724;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .video-section {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 15px;
    }
    
    .text-input-group {
        flex-direction: column;
    }
    
    .voice-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .video-list {
        grid-template-columns: 1fr;
    }
    
    /* 移动端视频容器优化 */
    .video-container {
        height: 100vh;
        width: 100vw;
    }
    
    #recordedVideo {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* 桌面端视频容器优化 */
@media (min-width: 769px) {
    .video-container {
        height: 100vh;
        width: 100vw;
    }
    
    #recordedVideo {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    .video-container {
        height: 100vh;
    }
    
    .controls {
        bottom: 20px;
    }
}

/* 竖屏模式优化 */
@media (orientation: portrait) {
    .video-container {
        height: 100vh;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.recording {
    animation: pulse 1s infinite;
} 


/* 视频加载时的样式 */
#recordedVideo.loading {
    opacity: 0.5;
}

/* 视频播放时的样式 */
#recordedVideo.playing {
    opacity: 1;
}

#recordedVideo {
    transition: opacity 0.1s ease-in-out; /* 缩短过渡时间 */
    background-color: #1a1a1a; /* 深灰色背景，避免纯黑 */
}

#recordedVideo.loading {
    opacity: 0.9; /* 提高loading时的透明度，减少黑屏感 */
}

#recordedVideo.playing {
    opacity: 1;
}

/* 优化加载指示器 */
.video-container.loading::before {
    opacity: 0.8; /* 降低加载指示器的透明度 */
    border-top-color: #667eea; /* 使用主题色 */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}