@media (max-width: 980px) {
    .lobby-shell {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .worlds-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .top-bar {
        padding: 10px 14px;
        flex-wrap: wrap;
    }

    .mode-tabs {
        grid-template-columns: 1fr;
    }

    .control-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px), (pointer: coarse) {
    .touch-controls.enabled {
        display: block;
    }

    .hud-controls-hint {
        display: none !important;
    }

    #hudSkillsRow {
        display: none !important;
    }

    .hud-exit-label {
        display: none;
    }

    .hud-icon-btn {
        padding: 5px 8px;
        min-width: 30px;
    }

    .hud-stamina-label {
        display: none;
    }

    #hudKnifeBadge {
        font-size: 0.7rem !important;
    }
}

/* Android / Mobile Portrait: Centered bottom joystick + vertical right action buttons + compact top status */
@media (max-width: 900px) and (orientation: portrait) {
    .hud-top {
        top: 6px;
        left: 8px;
        right: 8px;
        gap: 6px;
    }

    .hud-top-left {
        padding: 4px 8px;
        gap: 6px;
        flex-shrink: 0;
    }

    .boss-hud {
        min-width: 0;
        flex: 1 1 auto;
        max-width: min(225px, calc(100vw - 118px));
        padding: 5px 8px;
    }

    .boss-hud-title {
        font-size: 0.74rem;
        gap: 5px;
    }

    .hp-pip {
        width: 22px;
        height: 6px;
    }

    .boss-box-charge-tag {
        font-size: 0.62rem;
        padding: 1px 5px;
    }

    .boss-state-chip {
        margin-top: 4px;
        padding: 2px 8px;
    }

    .hud-phase-tag {
        font-size: 0.69rem;
    }

    .hud-bottom {
        top: 46px;
        bottom: auto;
        left: 8px;
        right: auto;
        max-width: calc(100vw - 24px);
    }

    .runner-hud {
        width: auto;
        max-width: 100%;
        padding: 5px 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        border-radius: 10px;
    }

    .runner-vitals-card {
        min-width: 96px;
        gap: 4px;
    }

    .hud-heart-pip {
        width: 20px;
        height: 18px;
        font-size: 0.76rem;
        border-radius: 5px;
    }

    .stamina-track {
        min-width: 82px;
        width: 82px;
        height: 7px;
    }

    .runner-weapon-pill {
        font-size: 0.68rem;
        padding: 3px 7px;
    }

    .hud-climax-banner {
        top: 132px;
        padding: 10px 12px;
    }

    .hud-alert-banner {
        top: 108px;
        font-size: 0.76rem;
        padding: 5px 10px;
    }

    .hud-mode-banner {
        top: 142px;
        font-size: 0.74rem;
        padding: 5px 10px;
    }

    .hud-bonus-box-toast {
        top: 88px;
        font-size: 0.76rem;
        padding: 4px 12px;
    }

    .training-hud-bar {
        top: 6px;
        left: 8px;
        right: 8px;
        transform: none;
        max-width: none;
        padding: 5px 8px;
        gap: 6px;
        justify-content: center;
    }

    .game-view.is-training .hud-top {
        top: 86px;
    }

    .game-view.is-training .hud-bottom {
        top: 124px;
    }

    .game-view.is-training .hud-alert-banner {
        top: 164px;
    }

    .game-view.is-training .hud-mode-banner {
        top: 198px;
    }

    .training-hud-bar.collapsed {
        top: 6px;
        right: 8px;
        left: auto;
        transform: none;
    }

    .game-view.is-training.training-hud-collapsed .hud-top {
        top: 8px;
        padding-right: 44px;
    }

    .game-view.is-training.training-hud-collapsed .hud-bottom {
        top: 48px;
    }

    .game-view.is-training.training-hud-collapsed .hud-alert-banner {
        top: 84px;
    }

    .game-view.is-training.training-hud-collapsed .hud-mode-banner {
        top: 118px;
    }

    .touch-joystick-zone {
        left: 50%;
        transform: translateX(-50%);
        bottom: 16px;
        width: 114px;
        height: 114px;
    }

    .touch-joystick-knob {
        width: 44px;
        height: 44px;
        margin: -22px 0 0 -22px;
    }

    .touch-buttons {
        right: 12px;
        bottom: 88px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 14px;
    }
}

/* Android / Mobile Landscape: Left bottom joystick + Right bottom compact button cluster + compact top status */
@media (max-width: 920px) and (orientation: landscape), (pointer: coarse) and (orientation: landscape) {
    .hud-top {
        top: 6px;
        left: 8px;
        right: 8px;
        gap: 6px;
    }

    .hud-top-left {
        padding: 4px 8px;
        gap: 6px;
        flex-shrink: 0;
    }

    .boss-hud {
        min-width: 0;
        max-width: 270px;
        padding: 5px 10px;
    }

    .boss-hud-title {
        font-size: 0.76rem;
    }

    .hp-pip {
        width: 24px;
        height: 6px;
    }

    .boss-box-charge-tag {
        font-size: 0.62rem;
        padding: 1px 5px;
    }

    .boss-state-chip {
        margin-top: 4px;
        padding: 2px 8px;
    }

    .hud-phase-tag {
        font-size: 0.7rem;
    }

    .hud-bottom {
        top: 44px;
        bottom: auto;
        left: 8px;
        right: auto;
    }

    .runner-hud {
        width: auto;
        max-width: none;
        padding: 5px 8px;
        gap: 7px;
        border-radius: 10px;
    }

    .runner-vitals-card {
        min-width: 96px;
        gap: 4px;
    }

    .hud-heart-pip {
        width: 20px;
        height: 18px;
        font-size: 0.76rem;
    }

    .stamina-track {
        min-width: 84px;
        width: 84px;
        height: 7px;
    }

    .runner-weapon-pill {
        font-size: 0.68rem;
        padding: 3px 7px;
    }

    .hud-climax-banner {
        top: 86px;
        padding: 9px 12px;
    }

    .hud-alert-banner {
        top: 64px;
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .hud-mode-banner {
        top: 98px;
        font-size: 0.73rem;
        padding: 5px 10px;
    }

    .training-hud-bar {
        top: 6px;
        left: 8px;
        right: 8px;
        transform: none;
        max-width: none;
        padding: 4px 8px;
        gap: 6px;
        justify-content: center;
    }

    .game-view.is-training .hud-top {
        top: 52px;
    }

    .game-view.is-training .hud-bottom {
        top: 90px;
    }

    .training-hud-bar.collapsed {
        top: 6px;
        right: 8px;
        left: auto;
        transform: none;
    }

    .game-view.is-training.training-hud-collapsed .hud-top {
        top: 6px;
        padding-right: 44px;
    }

    .game-view.is-training.training-hud-collapsed .hud-bottom {
        top: 44px;
    }

    .touch-joystick-zone {
        left: 16px;
        bottom: 16px;
        width: 108px;
        height: 108px;
        transform: none;
    }

    .touch-joystick-knob {
        width: 42px;
        height: 42px;
        margin: -21px 0 0 -21px;
    }

    .touch-buttons {
        right: 16px;
        bottom: 16px;
        display: grid;
        grid-template-columns: repeat(2, 58px);
        gap: 12px;
        align-items: center;
        justify-items: center;
    }

    .touch-btn--skill {
        grid-column: 2;
        grid-row: 1;
    }

    .touch-btn--sprint {
        grid-column: 1;
        grid-row: 2;
    }

    .touch-btn--action {
        grid-column: 2;
        grid-row: 2;
    }
}
