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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    padding: 15px;
}

.game-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1200px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.game-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.score, .bullets {
    font-size: 18px;
    font-weight: bold;
}

#startBtn {
    padding: 8px 16px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#startBtn:hover {
    background-color: #45a049;
}

#gameCanvas {
    border: 2px solid #333;
    background-color: white;
    max-width: 100%;
    height: auto;
}

.energy-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: bold;
}

.energy-bar {
    width: 100px;
    height: 20px;
    background-color: #eee;
    border-radius: 10px;
    overflow: hidden;
}

.energy-fill {
    width: 100%;
    height: 100%;
    background-color: #3498db;
    transition: width 0.2s ease-out;
}

.health {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c;
}

#health {
    letter-spacing: 2px;
}

.game-layout {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

.game-rules {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}

.game-rules h2 {
    color: #2c3e50;
    margin-top: 0;
    font-size: 1.4em;
}

.game-rules h3 {
    color: #34495e;
    margin: 15px 0 5px;
    font-size: 1.1em;
}

.game-rules ul {
    list-style-type: none;
    padding-left: 0;
    margin: 5px 0;
}

.game-rules li {
    margin: 5px 0;
    color: #555;
    font-size: 0.9em;
    line-height: 1.4;
}

/* 响应式布局调整 */
@media (max-width: 1024px) {
    .game-container {
        padding: 15px;
    }

    .game-layout {
        flex-direction: column;
        align-items: center;
    }

    .game-rules {
        max-width: 100%;
        order: 2;
    }

    #gameCanvas {
        order: 1;
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        align-items: stretch;
    }

    .game-info {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    .score, .bullets, .health, .energy-container {
        font-size: 16px;
    }

    .energy-bar {
        width: 80px;
    }

    .game-rules {
        font-size: 0.9em;
    }

    .game-rules h2 {
        font-size: 1.3em;
    }

    .game-rules h3 {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 10px;
    }

    .game-info {
        gap: 8px;
    }

    .score, .bullets, .health, .energy-container {
        font-size: 14px;
    }

    .game-rules {
        padding: 15px;
    }
}



/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    padding: 15px;
}

/* 屏幕样式 */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;  /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
}

/* 游戏屏幕特殊处理 */
#gameScreen {
    background: none;
    backdrop-filter: none;
}

/* 确保输入框和按钮在最上层 */
.login-container input,
.login-container button,
.leaderboard-container button {
    position: relative;
    z-index: 1001;
}

/* 登录容器样式 */
.login-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    min-width: 320px;
    animation: fadeIn 0.5s ease-out;
}

.login-container h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 28px;
}

/* 确保输入框在正确的位置且可以输入 */
.login-container input {
    width: 100%;
    padding: 12px 15px;
    margin: 15px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1001; /* 确保输入框在最上层 */
}

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

/* 排行榜样式 */
.leaderboard-container {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    min-width: 80%;
    max-width: 800px;
}

.leaderboard-container h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 20px;
    font-size: 28px;
}

#leaderboardTable {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
}

#leaderboardTable th,
#leaderboardTable td {
    padding: 15px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

#leaderboardTable th {
    background: #3498db;
    color: white;
    font-weight: bold;
}

#leaderboardTable tr:nth-child(even) {
    background: #f8f9fa;
}

#leaderboardTable tr:hover {
    background: #f1f3f5;
}

/* 按钮样式 */
button {
    padding: 12px 24px;
    margin: 10px;
    border: none;
    border-radius: 8px;
    background: #3498db;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
}

/* 游戏��器样式 */
.game-container {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 1200px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.game-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

/* 游戏元素样式 */
.score, .bullets, .health {
    font-size: 18px;
    font-weight: bold;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.health {
    color: #e74c3c;
}

.energy-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.energy-bar {
    width: 120px;
    height: 20px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

.energy-fill {
    width: 100%;
    height: 100%;
    background: #3498db;
    transition: width 0.3s ease-out;
}

/* 游戏画布样式 */
#gameCanvas {
    border: 3px solid #2c3e50;
    border-radius: 8px;
    background: white;
    max-width: 100%;
    height: auto;
}

/* 响应式布局 */
@media (max-width: 1024px) {
    .game-container {
        padding: 15px;
    }
    
    .leaderboard-container {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
    }
    
    .game-info {
        justify-content: center;
    }
    
    .login-container {
        width: 90%;
        padding: 30px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    .score, .bullets, .health, .energy-container {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .energy-bar {
        width: 80px;
    }
    
    #leaderboardTable th,
    #leaderboardTable td {
        padding: 8px;
        font-size: 14px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
    transition: opacity 0.5s;
}

.game-message.fade-out {
    opacity: 0;
}

.gm-code-input {
    padding: 8px 12px;
    border: 2px solid #3498db;
    border-radius: 4px;
    font-size: 16px;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
}

.gm-code-input:focus {
    border-color: #2980b9;
    box-shadow: 0 0 5px rgba(41, 128, 185, 0.5);
}