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

body {
    background: #0a0a12;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-family: 'Press Start 2P', monospace;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#game-wrapper {
    position: relative;
    width: 100%;
    max-width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

#canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

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

#touch-left, #touch-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    pointer-events: auto;
}

#touch-left {
    max-width: 140px;
}

#touch-right {
    max-width: 140px;
    justify-content: flex-end;
}

.touch-btn {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(20, 20, 40, 0.7);
    color: #fff;
    font-size: 18px;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
    background: rgba(60, 60, 100, 0.8);
    border-color: rgba(255,255,255,0.6);
}

.attack-btn {
    background: rgba(40, 10, 10, 0.7);
    border-color: rgba(255, 80, 80, 0.4);
}

#btn-special {
    background: rgba(50, 40, 10, 0.7);
    border-color: rgba(255, 200, 50, 0.4);
}

#game-footer {
    padding: 6px;
    text-align: center;
    z-index: 10;
}

#game-footer a {
    color: rgba(255,255,255,0.25);
    text-decoration: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
}

#game-footer a:hover {
    color: rgba(255,255,255,0.5);
}

@media (pointer: coarse) {
    #touch-controls {
        display: flex !important;
    }
}