* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0a0a12;
    overflow: hidden;
    font-family: 'Press Start 2P', monospace;
    touch-action: none;
}

#canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

#touch-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 100;
    pointer-events: none;
}

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

.dpad-btn {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s;
}

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

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

.action-btn {
    width: 90px;
    height: 90px;
    background: linear-gradient(145deg, #ff3344, #cc1122);
    border: 4px solid #ff6677;
    border-radius: 50%;
    color: white;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 50, 70, 0.5);
    pointer-events: auto;
    transition: all 0.1s;
}

.action-btn:active {
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(255, 50, 70, 0.5);
}

#footer {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 50;
    display: flex;
    gap: 15px;
}

#footer a {
    color: #ffd700;
    text-decoration: none;
}

#footer a:hover {
    text-decoration: underline;
}

@media (pointer: coarse), (max-width: 800px) {
    #touch-controls {
        display: flex;
    }
    #footer {
        bottom: 180px;
    }
}