/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== 加载屏幕 ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h2 {
    margin-bottom: 10px;
    font-weight: 600;
}

.loading-content p {
    opacity: 0.8;
    font-size: 14px;
}

/* ===== 主容器 ===== */
.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 游戏标题 ===== */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ===== 游戏主体区域 ===== */
.game-main {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* ===== 游戏区域 ===== */
.game-area {
    position: relative;
    flex-shrink: 0;
}

#gameCanvas {
    background: linear-gradient(180deg, #87CEEB 0%, #98D982 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

/* ===== 游戏覆盖层 ===== */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 15px;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    border-radius: 15px;
}

.screen.hidden {
    display: none;
}

.screen h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.screen p {
    font-size: 1.2rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

/* ===== 按钮样式 ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* ===== 游戏HUD ===== */
.game-hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    z-index: 10;
}

.hud-score {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hud-controls {
    display: flex;
    gap: 10px;
}

.hud-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ===== 控制面板 ===== */
.control-panel {
    flex: 1;
    min-width: 350px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.control-panel h3 {
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 1.2rem;
}

.control-panel section {
    margin-bottom: 30px;
}

/* ===== 摄像头区域 ===== */
.camera-section {
    margin-bottom: 30px;
}

.camera-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

#videoPreview {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

#faceCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.camera-status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    color: white;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6b6b;
}

.status-indicator.online .status-dot {
    background: #4ecdc4;
}

.camera-controls {
    display: flex;
    gap: 10px;
}

/* ===== 设置区域 ===== */
.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.setting-item input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.setting-item input[type="checkbox"] {
    margin-right: 8px;
}

.setting-item small {
    color: #888;
    font-size: 12px;
}

.difficulty-toggle {
    display: flex;
    border: 2px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 5px;
    position: relative;
    height: 44px;
}

.difficulty-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.difficulty-option {
    flex: 1;
    padding: 0;
    margin: 0;
    text-align: center;
    background-color: #f8f8f8;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    border: none;
    user-select: none;
    
    /* 确保完全填充和垂直居中 */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    z-index: 1;
    line-height: 1;
    min-height: 44px;
}

.difficulty-option:first-of-type {
    border-right: 1px solid #ddd;
}

/* 未选中状态的悬停效果 */
.difficulty-option:hover {
    background-color: #e8f5e8;
}

/* 选中状态 - 使用更强的选择器 */
.difficulty-toggle input[type="radio"]:checked + label.difficulty-option {
    background-color: #4CAF50 !important;
    color: white !important;
    font-weight: 600;
}

/* 选中状态的悬停效果 */
.difficulty-toggle input[type="radio"]:checked + label.difficulty-option:hover {
    background-color: #45a049 !important;
    color: white !important;
}

/* ===== 统计区域 ===== */
.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

/* ===== 健康提示 ===== */
.health-tips {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.tip-content {
    font-size: 14px;
    line-height: 1.5;
}

/* ===== 模态框 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.tutorial-step {
    margin-bottom: 25px;
}

.tutorial-step h4 {
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.tutorial-step p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 5px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    text-align: center;
}

/* ===== 分数信息 ===== */
.score-info {
    margin: 20px 0;
}

.score-info p {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.score-info span {
    font-weight: 700;
    color: #ff6b6b;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .game-main {
        flex-direction: column;
        align-items: center;
    }
    
    .control-panel {
        min-width: 100%;
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .control-panel {
        padding: 20px;
    }
}

/* ===== 动画效果 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.game-container {
    animation: fadeIn 0.6s ease-out;
}

.control-panel {
    animation: slideIn 0.8s ease-out 0.2s both;
}

/* ===== 帮助按钮 ===== */
.help-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 5px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    background: #5a67d8;
    transform: scale(1.1);
}

/* ===== 控制说明模态框样式 ===== */
.control-mode-section {
    margin-bottom: 20px;
}

.control-mode-section h4 {
    color: #333;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1.1rem;
}

.control-description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.control-description p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.control-description strong {
    color: #333;
}

.mode-benefits {
    color: #4ecdc4 !important;
    font-size: 0.9rem;
    margin-bottom: 5px !important;
}

.control-tips {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.control-tips h4 {
    color: white;
    margin-bottom: 10px;
}

.control-tips ul {
    margin: 0;
    padding-left: 20px;
}

.control-tips li {
    margin-bottom: 5px;
    line-height: 1.4;
}

.game-tips {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.game-tips h4 {
    color: white;
    margin-bottom: 10px;
}

.game-tips ul {
    margin: 0;
    padding-left: 20px;
}

.game-tips li {
    margin-bottom: 5px;
    line-height: 1.4;
}

.game-tips strong {
    color: #FFE135;
}

/* ===== 隐藏类 ===== */
.hidden {
    display: none !important;
} 