/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* 屏幕切换 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease-in-out;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* 启动界面 */
#start-screen {
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a0a 100%);
    flex-direction: column;
}

.title-container {
    text-align: center;
    z-index: 10;
}

.game-title {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

.game-subtitle {
    font-size: 1.5rem;
    color: #888;
    margin-bottom: 2rem;
    font-style: italic;
}

.game-description {
    font-size: 1.2rem;
    color: #aaa;
    margin-bottom: 3rem;
    max-width: 600px;
    line-height: 1.6;
}

.start-button {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

/* 游戏界面 */
#game-screen {
    background: linear-gradient(180deg, #000011 0%, #000033 100%);
    position: relative;
}

/* 摄像头画面 */
#camera-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 320px;
    height: 240px;
    border: 2px solid rgba(0, 212, 255, 0.6);
    border-radius: 15px;
    overflow: hidden;
    z-index: 20;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        border-color: rgba(0, 212, 255, 0.6);
        box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
    }
    50% { 
        border-color: rgba(0, 212, 255, 1);
        box-shadow: 0 4px 30px rgba(0, 212, 255, 0.6);
    }
}

#camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* 镜像显示 */
}

#camera-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scaleX(-1); /* 镜像显示 */
}


#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* HUD界面 */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.hud-label {
    font-size: 0.9rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.progress-bar, .energy-bar {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill, .energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #0099cc);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.timer, .score, .difficulty {
    font-size: 1.5rem;
    font-weight: bold;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.score {
    color: #ffaa00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

.difficulty {
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

.mirror-status {
    color: #00ff44;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 255, 68, 0.5);
}

.mirror-status:hover {
    color: #00d4ff;
    transform: scale(1.1);
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.7);
}

/* 任务提示 */
.task-prompt {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 40px;
    border-radius: 25px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    backdrop-filter: blur(10px);
}

#prompt-text {
    font-size: 1.1rem;
    color: #ffffff;
    margin: 0 0 15px 0;
}

.gesture-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.gesture-status span {
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #aaa;
    transition: all 0.3s ease;
}

.gesture-status span.detected {
    color: #00ff44;
    border-color: #00ff44;
    box-shadow: 0 0 10px rgba(0, 255, 68, 0.3);
}

.gesture-status span.not-detected {
    color: #ff4444;
    border-color: #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
}


/* 粒子效果容器 */
#particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* 结算界面 */
#result-screen {
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a0a 100%);
    flex-direction: column;
}

.result-container {
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    backdrop-filter: blur(10px);
}

.result-title {
    font-size: 2.5rem;
    color: #00d4ff;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.result-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    gap: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.stat-label {
    font-size: 1rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5rem;
    color: #00d4ff;
    font-weight: bold;
}

.restart-button {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

/* 暂停界面 */
#pause-screen {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.pause-container {
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.pause-title {
    font-size: 2rem;
    color: #00d4ff;
    margin-bottom: 30px;
}

.resume-button, .main-menu-button {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.resume-button:hover, .main-menu-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

/* 动画效果 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 212, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.8); }
}

.energy-fill {
    animation: glow 2s ease-in-out infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .game-subtitle {
        font-size: 1.2rem;
    }
    
    .hud-item {
        font-size: 0.8rem;
    }
    
    .progress-bar, .energy-bar {
        width: 150px;
    }
    
    .result-stats {
        flex-direction: column;
        gap: 20px;
    }
}

/* 摄像头权限错误样式 */
.camera-instructions {
    text-align: left;
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.camera-instructions h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.camera-instructions ol {
    color: #aaa;
    line-height: 1.6;
    padding-left: 20px;
}

.camera-instructions li {
    margin-bottom: 8px;
}

/* 成就系统样式 */
.achievements-section {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 50, 100, 0.3);
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.4);
}

.achievements-section h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 18px;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement-item {
    background: rgba(0, 212, 255, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 4px solid #00d4ff;
    color: #ffffff;
    font-size: 14px;
    text-align: left;
    animation: achievement-glow 2s ease-in-out;
}

/* 失败原因样式 */
.failure-reason {
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 0, 0, 0.4);
}

.failure-reason h3 {
    color: #ff4444;
    margin-bottom: 10px;
    font-size: 18px;
}

.failure-reason p {
    color: #ff6666;
    font-size: 16px;
    margin: 0;
}

/* 能量警告动画 */
@keyframes pulse-warning {
    0%, 100% { 
        transform: translateX(-50%) scale(1);
        opacity: 0.9;
    }
    50% { 
        transform: translateX(-50%) scale(1.05);
        opacity: 1;
    }
}

/* 成就发光动画 */
@keyframes achievement-glow {
    0% { 
        background: rgba(0, 212, 255, 0.1);
        box-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
    }
    50% { 
        background: rgba(0, 212, 255, 0.2);
        box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
    }
    100% { 
        background: rgba(0, 212, 255, 0.1);
        box-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
    }
}

