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

body {
    background: #0a0a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Press Start 2P', monospace;
}

#game-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid #00ff88;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.5);
}

#touch-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 180px;
    pointer-events: none;
    z-index: 100;
}

@media (pointer: coarse) {
    #touch-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
    }
}

#dpad {
    position: relative;
    width: 140px;
    height: 140px;
    pointer-events: auto;
}

.dpad-btn {
    position: absolute;
    width: 48px;
    height: 48px;
    background: rgba(0, 255, 136, 0.2);
    border: 2px solid rgba(0, 255, 136, 0.5);
    border-radius: 8px;
    color: #00ff88;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.dpad-btn:active {
    background: rgba(0, 255, 136, 0.5);
}

#btn-up { top: 0; left: 50%; transform: translateX(-50%); }
#btn-down { bottom: 0; left: 50%; transform: translateX(-50%); }
#btn-left { top: 50%; left: 0; transform: translateY(-50%); }
#btn-right { top: 50%; right: 0; transform: translateY(-50%); }

#action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    pointer-events: auto;
}

.action-btn {
    width: 56px;
    height: 56px;
    background: rgba(255, 200, 0, 0.2);
    border: 2px solid rgba(255, 200, 0, 0.5);
    border-radius: 50%;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.action-btn:active {
    background: rgba(255, 200, 0, 0.5);
}

#game-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #00ff8880;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

#game-footer a {
    color: #00ff88;
    text-decoration: none;
}

#game-footer a:hover {
    text-shadow: 0 0 10px #00ff88;
}