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

body {
    font-family: 'Arial', sans-serif;
    background-color: #0a0a0a;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.game-info {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    font-size: 20px;
    font-weight: bold;
    flex-wrap: wrap;
    justify-content: center;
    z-index: 10;
}

.score, .lives, .high-score {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

/* 最高分样式 */
.high-score {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    animation: pulse 2s infinite;
}

/* 新记录提示 */
.new-record {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 215, 0, 0.9);
    color: #000;
    font-size: 48px;
    font-weight: bold;
    padding: 20px 40px;
    border-radius: 10px;
    z-index: 100;
    animation: recordPop 3s ease-out;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
}

@keyframes recordPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.8;
    }
}

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

.direction-pad {
    position: relative;
    width: 180px;
    height: 180px;
}

.control-btn {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.1s;
}

.control-btn:active {
    background-color: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

#btn-up { top: 0; left: 60px; }
#btn-left { top: 60px; left: 0; }
#btn-down { top: 120px; left: 60px; }
#btn-right { top: 60px; left: 120px; }

.fire-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.3);
    border: 2px solid rgba(255, 0, 0, 0.6);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s;
}

.fire-btn:active {
    background-color: rgba(255, 0, 0, 0.5);
    transform: scale(0.95);
}

/* 暂停按钮 */
.pause-btn {
    padding: 10px 20px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.pause-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.pause-btn:active {
    transform: scale(0.95);
}

/* 游戏屏幕 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.screen h1 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #4CAF50;
    text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(76, 175, 80, 0.5); }
    to { text-shadow: 0 0 30px rgba(76, 175, 80, 0.8), 0 0 40px rgba(76, 175, 80, 0.5); }
}

.screen p {
    font-size: 20px;
    margin-bottom: 15px;
    color: #ccc;
}

.primary-btn {
    margin-top: 20px;
    padding: 15px 40px;
    font-size: 24px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn:hover {
    background-color: #45a049;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.primary-btn:active {
    transform: scale(0.95);
}

.primary-btn.secondary {
    background-color: #FF9800;
    margin-left: 20px;
}

.primary-btn.secondary:hover {
    background-color: #F57C00;
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

#game-over, #pause-screen {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
    
    .game-info {
        top: 10px;
        left: 10px;
        right: 10px;
        justify-content: center;
        font-size: 16px;
        gap: 15px;
        padding: 8px 15px;
    }
    
    .screen h1 {
        font-size: 32px;
    }
    
    .screen p {
        font-size: 16px;
    }
    
    .primary-btn {
        padding: 12px 24px;
        font-size: 18px;
    }
    
    .new-record {
        font-size: 36px;
        padding: 15px 30px;
    }
}

@media (max-height: 500px) {
    .mobile-controls {
        bottom: 10px;
        padding: 0 10px;
    }
    
    .direction-pad {
        width: 140px;
        height: 140px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    #btn-up { top: 0; left: 45px; }
    #btn-left { top: 45px; left: 0; }
    #btn-down { top: 90px; left: 45px; }
    #btn-right { top: 45px; left: 90px; }
    
    .fire-btn {
        width: 80px;
        height: 80px;
        font-size: 16px;
    }
}