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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: white;
}

.game-container {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.score-display {
    display: flex;
    gap: 30px;
    font-size: 18px;
    font-weight: bold;
}

#gameCanvas {
    border: 3px solid #4CAF50;
    border-radius: 10px;
    display: block;
    background: #000;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.game-controls {
    margin-top: 15px;
    text-align: center;
}

.control-buttons {
    margin-bottom: 15px;
}

.control-buttons button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 0 5px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.control-buttons button:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.mobile-controls {
    display: none;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    margin-top: 10px;
}

.d-pad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 5px;
    justify-content: center;
}

.dpad-btn {
    background: #333;
    color: white;
    border: 2px solid #555;
    border-radius: 8px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.dpad-btn:active {
    background: #555;
    transform: scale(0.95);
}

.dpad-btn[data-direction="up"] {
    grid-column: 2;
    grid-row: 1;
}

.dpad-btn[data-direction="down"] {
    grid-column: 2;
    grid-row: 3;
}

.dpad-btn[data-direction="left"] {
    grid-column: 1;
    grid-row: 2;
}

.dpad-btn[data-direction="right"] {
    grid-column: 3;
    grid-row: 2;
}

#fireBtn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

#fireBtn:active {
    background: #cc0000;
    transform: scale(0.95);
}

.game-menu, .game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    z-index: 10;
}

.game-menu h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-menu p {
    font-size: 18px;
    margin-bottom: 30px;
    color: #ccc;
}

.game-menu button, .game-over button {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
    font-weight: bold;
}

.game-menu button:hover, .game-over button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.3);
}

.instructions {
    text-align: center;
    max-width: 400px;
    line-height: 1.6;
}

.instructions h3 {
    margin-bottom: 10px;
    color: #4CAF50;
}

.game-over h2 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #ff6b6b;
}

#finalScore {
    font-size: 24px;
    margin-bottom: 20px;
    color: #4ecdc4;
}

@media (max-width: 768px) {
    .mobile-controls {
        display: grid;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    .game-container {
        padding: 15px;
        margin: 10px;
    }
    
    .score-display {
        font-size: 14px;
        gap: 15px;
    }
}