.joystick-base {
    position: fixed;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--hud-bg, rgba(10, 10, 26, 0.85));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.joystick-base.active {
    opacity: 1;
}

.joystick-knob {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    opacity: 0.6;
    transition: transform 0.05s, opacity 0.1s, box-shadow 0.1s;
}

/* ── Movement joystick (left, blue) ── */
.joystick-move {
    border: 2px solid rgba(50, 140, 255, 0.4);
}

.joystick-knob-move {
    background: #3490ff;
}

.joystick-knob-move.boosting {
    opacity: 1;
    box-shadow: 0 0 14px rgba(50, 140, 255, 0.8);
    background: #60b0ff;
}

/* ── Fire joystick (right, red) ── */
.joystick-fire {
    border: 2px solid rgba(255, 60, 60, 0.4);
}

.joystick-knob-fire {
    background: #ff3c3c;
}

#joystick-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
}

@media (pointer: coarse), (hover: none) {
    .joystick-base {
        display: flex;
    }

    #joystick-container {
        pointer-events: auto;
    }
}

/* Landscape touch: joysticks always visible at default positions */
@media (pointer: coarse) and (orientation: landscape) {
    .joystick-move {
        bottom: max(24px, env(safe-area-inset-bottom));
        left: max(24px, env(safe-area-inset-left));
        opacity: 0.35;
    }

    .joystick-fire {
        bottom: max(24px, env(safe-area-inset-bottom));
        right: max(24px, env(safe-area-inset-right));
        opacity: 0.35;
    }
}
