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

body {
    font-family: 'Arial', sans-serif;
    background-color: #1a1a1a;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

/* 游戏容器 */
.game-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 游戏标题栏 */
.game-header {
    padding: 15px;
    background-color: #333;
    border-radius: 8px;
    text-align: center;
}

/* 游戏主要区域布局 */
.game-main {
    display: flex;
    gap: 20px;
    width: 100%;
}

/* 游戏信息区域 */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #333;
    border-radius: 8px 8px 0 0;
    gap: 20px;
}

.game-header h1 {
    font-size: 1.8rem;
    color: #4CAF50;
}

.score-container, .lives-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.lives {
    font-weight: bold;
    color: #FF6B6B;
}

.pause-btn {
    background-color: #FF9800;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.pause-btn:hover {
    background-color: #F57C00;
}

.score {
    font-weight: bold;
    color: #FFD700;
}

/* 游戏包装器 */
.game-wrapper {
    position: relative;
    width: 800px;
    background-color: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* 游戏画布 */
#gameCanvas {
    width: 100%;
    display: block;
    background-color: #111;
    cursor: none;
    background-image: 
        linear-gradient(rgba(50, 50, 50, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(50, 50, 50, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: 0 0;
}

/* 操作说明区域 */
.game-instructions {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    padding: 20px;
    background-color: #333;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.game-instructions h3 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 1.4rem;
    text-align: center;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

.game-instructions ul {
    list-style-type: none;
    line-height: 1.8;
}

.game-instructions li {
    margin-bottom: 8px;
    padding-left: 5px;
    border-left: 3px solid transparent;
    transition: border-color 0.3s;
}

.game-instructions li:hover {
    border-left-color: #4CAF50;
}

.game-instructions strong {
    color: #FF9800;
}

/* 移动端控制按钮 */
.mobile-controls {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    display: none;
}

/* 控制方向板 */
.control-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.control-row {
    display: flex;
    gap: 5px;
}

.control-btn, .fire-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background-color: rgba(76, 175, 80, 0.7);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
}

.control-btn:active, .fire-btn:active {
    transform: scale(0.95);
    background-color: rgba(76, 175, 80, 0.9);
}

.fire-btn {
    width: 80px;
    height: 80px;
    background-color: rgba(255, 87, 34, 0.7);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fire-btn:active {
    background-color: rgba(255, 87, 34, 0.9);
}

/* 开始和结束屏幕 */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay-content {
    background-color: #333;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    max-width: 400px;
    width: 90%;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-main {
        flex-direction: column;
    }
    
    .game-wrapper {
        width: 100%;
    }
    
    .game-instructions {
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .game-instructions {
        padding: 15px;
    }
}

.overlay-content h2 {
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 2rem;
}

.overlay-content p {
    margin-bottom: 15px;
    color: #ccc;
}

#startButton, #restartButton {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s;
}

#startButton:hover, #restartButton:hover {
    background-color: #45a049;
}

#gameOverScreen, #pauseScreen {
    display: none;
}

.overlay-content button {
    margin: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .score-container {
        font-size: 1rem;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    .control-btn, .fire-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .fire-btn {
        width: 70px;
        height: 70px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 5px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .control-btn, .fire-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .fire-btn {
        width: 60px;
        height: 60px;
        font-size: 0.9rem;
    }
}