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

body {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    touch-action: none;
}

#game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#game-container {
    position: relative;
    width: 528px;
    height: 432px;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.screen {
    text-align: center;
    pointer-events: auto;
    color: #fff;
}

.hidden { display: none !important; }

.game-title {
    font-size: 48px;
    color: #ff6600;
    text-shadow: 3px 3px 0 #880000;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

.subtitle {
    font-size: 12px;
    color: #888;
    margin-bottom: 24px;
}

.instructions {
    font-size: 11px;
    color: #aaa;
    margin-top: 16px;
    line-height: 1.6;
}

.pause-title {
    font-size: 36px;
    color: #fff;
    margin-bottom: 16px;
}

.gameover-title {
    font-size: 36px;
    color: #ff0000;
    margin-bottom: 12px;
}

.final-score {
    font-size: 18px;
    color: #fff;
    margin-bottom: 16px;
}

.btn {
    background: #333;
    color: #fff;
    border: 2px solid #666;
    padding: 10px 24px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 2px;
    transition: background 0.1s;
}

.btn:hover { background: #555; }
.btn:active { background: #777; }

.btn-start {
    font-size: 20px;
    padding: 12px 32px;
    border-color: #ff6600;
    color: #ff6600;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

#controls-bar {
    display: flex;
    gap: 8px;
}

#touch-controls {
    display: none;
    gap: 16px;
    align-items: center;
    padding: 8px;
}

.touch-only { display: none; }

#dpad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left down right";
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(2, 44px);
    gap: 2px;
}

.dpad-btn {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dpad-btn:active { background: #666; }
.dpad-up { grid-area: up; }
.dpad-left { grid-area: left; }
.dpad-down { grid-area: down; }
.dpad-right { grid-area: right; }

.btn-pump {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 12px;
    background: #880000;
    border-color: #ff4400;
    color: #ff4400;
}

.btn-pump:active { background: #aa0000; }

@media (max-width: 600px) {
    #game-container {
        width: 100vw;
        height: calc(100vw * 432 / 528);
        max-height: 70vh;
    }
    #game-canvas { width: 100%; height: 100%; }
    #touch-controls { display: flex; }
    #controls-bar .btn-sm:first-child { display: none; }
}
