/* ACHIEVO — touch UX (mobile tabs, swipe hints) */

@media (max-width: 820px) {
    html.achievo-mobile.has-mobile-tabs {
        --achievo-mobile-tabs-h: 44px;
    }

    html.achievo-mobile.has-mobile-tabs .window,
    html.achievo-mobile.has-mobile-tabs .window[style],
    html.achievo-mobile.has-mobile-tabs .wos-window.is-open,
    html.achievo-mobile.has-mobile-tabs .wos-window.is-open[style] {
        bottom: calc(
            var(--achievo-safe-bottom)
            + var(--achievo-taskbar-h, 42px)
            + var(--achievo-mobile-tabs-h, 44px)
            + var(--achievo-mobile-gap, 8px)
        ) !important;
    }

    html.achievo-mobile .window.is-dragging,
    html.achievo-mobile .wos-window.is-dragging {
        cursor: default !important;
    }

    .achievo-mobile-tabs {
        display: none;
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--achievo-taskbar-h, 42px) + var(--achievo-safe-bottom, 0px));
        z-index: 12000;
        align-items: center;
        gap: 6px;
        padding: 6px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        background: rgba(6, 10, 14, 0.94);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(8px);
    }

    .achievo-mobile-tabs::-webkit-scrollbar {
        display: none;
    }

    .achievo-mobile-tabs.is-visible {
        display: flex;
    }

    .achievo-mobile-tabs__btn {
        flex: 0 0 auto;
        max-width: 148px;
        min-height: var(--achievo-touch-min, 44px);
        padding: 8px 12px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.06);
        color: #dce4ea;
        font: 600 11px/1.2 'JetBrains Mono', Consolas, monospace;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .achievo-mobile-tabs__btn.is-active {
        border-color: rgba(0, 255, 170, 0.55);
        background: rgba(0, 255, 170, 0.14);
        color: #b8ffe8;
    }

    .achievo-mobile-tabs__btn:active {
        transform: scale(0.97);
    }

    .achievo-mobile-tabs__close {
        flex: 0 0 auto;
        min-width: var(--achievo-touch-min, 44px);
        min-height: var(--achievo-touch-min, 44px);
        padding: 0 10px;
        border: 1px solid rgba(255, 90, 90, 0.35);
        border-radius: 8px;
        background: rgba(255, 60, 60, 0.12);
        color: #ffb4b4;
        font-size: 16px;
        line-height: 1;
        touch-action: manipulation;
    }

    .achievo-touch-swipe-hint {
        position: absolute;
        top: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.22);
        pointer-events: none;
    }

    html.achievo-mobile .w-header,
    html.achievo-mobile .wos-window__header,
    html.achievo-mobile .linux-terminal-header {
        touch-action: pan-x pinch-zoom;
        user-select: none;
        -webkit-user-select: none;
    }

    html.achievo-mobile .wos-icon,
    html.achievo-mobile .d-icon,
    html.achievo-mobile .mil-icons .wos-icon {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    html.achievo-mobile .wos-icon:active,
    html.achievo-mobile .d-icon:active {
        transform: scale(0.96);
        opacity: 0.88;
    }

    html.achievo-mobile .window:not(.achievo-mobile-active):not(.achievo-mobile-hidden),
    html.achievo-mobile .wos-window.is-open:not(.achievo-mobile-active):not(.achievo-mobile-hidden) {
        /* fallback when stack mode off */
    }

    html.achievo-mobile .achievo-mobile-hidden {
        visibility: hidden !important;
        pointer-events: none !important;
    }
}
