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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

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

/* Touch Controls */
#touch-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    pointer-events: none;
    z-index: 10;
}

.touch-btn {
    position: absolute;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}

.touch-btn:active, .touch-btn.active {
    background: rgba(255, 255, 255, 0.35);
}

#touch-left {
    left: 20px;
    bottom: 30px;
}

#touch-right {
    left: 100px;
    bottom: 30px;
}

#touch-action {
    right: 20px;
    bottom: 30px;
    font-weight: bold;
    font-size: 20px;
}

/* UI Overlay */
#ui-overlay {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 20;
}

.ui-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.ui-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

.ui-btn.muted {
    opacity: 0.4;
}

/* Show touch controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    #touch-controls {
        display: block;
    }
}

@media (max-width: 480px) {
    #touch-controls {
        display: block;
    }

    .touch-btn {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }

    #touch-left {
        left: 16px;
        bottom: 24px;
    }

    #touch-right {
        left: 84px;
        bottom: 24px;
    }

    #touch-action {
        right: 16px;
        bottom: 24px;
    }
}
