/* ACHIEVO — mobile shell overrides (game.html + Work OS + global) */

@media (max-width: 820px) {
    html.achievo-mobile,
    body.achievo-mobile {
        overflow-x: hidden;
    }

    /* ── Virtual OS windows (game.html) ── */
    .window,
    .window.window-resizable,
    .window[style] {
        position: fixed !important;
        top: calc(var(--achievo-safe-top) + var(--achievo-panel-h) + var(--achievo-mobile-gap)) !important;
        left: var(--achievo-mobile-gap) !important;
        right: var(--achievo-mobile-gap) !important;
        bottom: calc(var(--achievo-safe-bottom) + var(--achievo-mobile-gap)) !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: none !important;
        transform: none !important;
        resize: none !important;
        animation: none !important;
    }

    .window .w-header {
        padding: 12px 14px;
        min-height: var(--achievo-touch-min);
    }

    .w-close {
        width: 36px !important;
        height: 36px !important;
    }

    /* ── Linux desktop (game.html) ── */
    #desktop.linux-de .linux-panel {
        padding: 0 6px;
        gap: 6px;
    }

    #desktop.linux-de .linux-panel-center {
        display: none;
    }

    #desktop.linux-de .linux-panel-end .linux-tray-label {
        display: none;
    }

    #desktop.linux-de .linux-start-btn span:not(.linux-logo):not(.vos-neon-logo) {
        display: none;
    }

    #desktop.linux-de .desktop-icons {
        top: calc(var(--achievo-panel-h) + 6px);
        left: 6px;
        right: 6px;
        width: auto;
        max-height: none;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #desktop.linux-de .desktop-icons::-webkit-scrollbar {
        display: none;
    }

    #desktop.linux-de .d-icon {
        flex: 0 0 56px;
        width: 56px;
    }

    #desktop.linux-de .d-label {
        font-size: 8px;
    }

    /* ── Work OS shell ── */
    body.wos-body {
        overflow-x: hidden;
        overflow-y: auto;
        min-height: 100dvh;
        min-height: 100vh;
    }

    body.wos-body .wos-desktop {
        min-height: calc(100dvh - var(--achievo-taskbar-h));
        min-height: calc(100vh - var(--achievo-taskbar-h));
        height: auto;
        padding-bottom: calc(var(--achievo-taskbar-h) + var(--achievo-safe-bottom));
    }

    body.wos-body .wos-taskbar {
        height: calc(var(--achievo-taskbar-h) + var(--achievo-safe-bottom));
        padding-bottom: var(--achievo-safe-bottom);
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }

    body.wos-body .wos-taskbar__start,
    body.wos-body .wos-taskbar__btn {
        padding: 10px 14px;
        font-size: 11px;
    }

    body.wos-body .wos-icons {
        position: relative;
        top: auto;
        left: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px;
        max-width: 100%;
    }

    body.wos-body .wos-icon {
        width: auto;
        min-width: 72px;
        flex: 1 1 calc(33.333% - 8px);
        max-width: calc(50% - 4px);
        min-height: var(--achievo-touch-min);
    }

    .wos-window,
    .wos-window[style],
    .wos-window.is-open {
        position: fixed !important;
        top: calc(var(--achievo-safe-top) + 52px) !important;
        left: 4px !important;
        right: 4px !important;
        bottom: calc(var(--achievo-taskbar-h) + var(--achievo-safe-bottom) + 4px) !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        z-index: 500 !important;
    }

    .wos-window__header {
        min-height: var(--achievo-touch-min);
        padding: 10px 12px;
    }

    .wos-window__close {
        min-width: 36px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .wos-toast {
        left: 8px;
        right: 8px;
        top: calc(var(--achievo-safe-top) + 8px);
    }

    /* ── Military command shell (C-UAS + UNIT-7) ── */
    .military-os .mil-command {
        position: relative;
        flex-wrap: wrap;
        height: auto;
        min-height: 48px;
        gap: 8px;
        padding: 8px 10px;
    }

    .military-os .mil-command__brand em,
    .military-os .mil-command__brand strong {
        font-size: 10px;
    }

    .military-os .mil-dock {
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        width: 100% !important;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid rgba(0, 255, 170, 0.2);
        padding: 6px 8px;
    }

    .military-os .mil-dock__title {
        display: none;
    }

    .military-os .mil-icons {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
    }

    .military-os .mil-icons .wos-icon {
        flex: 0 0 auto;
        min-width: 56px;
        min-height: var(--achievo-touch-min);
    }

    .military-os .mil-icons .wos-icon__label b,
    .military-os .mil-icons .wos-icon__label span {
        display: none;
    }

    .military-os .mil-home {
        padding: 8px;
    }

    .military-os .mil-map-window,
    .military-os .mil-map-window.is-open {
        top: calc(var(--achievo-safe-top) + 108px) !important;
    }

    .u7-ops-footer {
        left: 0 !important;
        right: 0;
        font-size: 9px;
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px 8px;
    }

    /* ── Civilian / Gov desktop icons on work pages ── */
    .civilian-os .wos-icons,
    .gov-os .wos-icons {
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
    }

    /* ── Map HUD ── */
    .map-hud-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .map-hud-item {
        min-width: 140px;
        flex-shrink: 0;
    }

    /* ── Browser chrome inside windows ── */
    .browser-nav {
        flex-wrap: wrap;
        gap: 6px;
    }

    .browser-nav input {
        min-width: 0;
        flex: 1 1 100%;
    }
}

@media (max-width: 520px) {
    body.wos-body .wos-icon {
        flex: 1 1 calc(50% - 6px);
        max-width: none;
    }

    #desktop.linux-de .d-icon {
        flex-basis: 48px;
        width: 48px;
    }

    .mil-command__telemetry span:nth-child(n+3) {
        display: none;
    }

    .u7-time-controls {
        flex-wrap: wrap;
        max-width: calc(100vw - 16px);
    }
}
