
/* NUJIZ MOBILE WORKSPACE V2 */

@media (max-width:767px) {

    /* =====================================
       1. NATURAL MOBILE WORKSPACE
       ===================================== */

    html body #toolWorkspace {
        width:100%!important;
        max-width:100%!important;
        min-width:0!important;
        height:auto!important;
        max-height:none!important;
        overflow:visible!important;
    }

    html body #toolWorkspace
    :is(
        .tool-workspace,
        .video-workspace,
        .image-workspace,
        .video-editor-layout,
        .image-editor-layout
    ) {
        min-width:0!important;
        height:auto!important;
        max-height:none!important;
        overflow:visible!important;
        grid-template-columns:minmax(0,1fr)!important;
    }

    /* =====================================
       2. REMOVE NESTED SETTINGS SCROLL
       ===================================== */

    html body #toolWorkspace
    :is(
        #videoDynamicControls,
        #dynamicControls,
        #imageDynamicControls,
        .video-controls-panel,
        .image-controls-panel,
        .video-settings-panel,
        .image-settings-panel,
        .tool-controls,
        .video-controls,
        .image-controls,
        .nsw-controls,
        .nsw-controls-scroll
    ) {
        position:relative!important;
        inset:auto!important;
        width:100%!important;
        min-width:0!important;
        height:auto!important;
        max-height:none!important;
        overflow:visible!important;
        overscroll-behavior:auto!important;
        scrollbar-width:auto!important;
    }

    /* =====================================
       3. STOP MOVING STUDIO HEADERS
       ===================================== */

    html body #toolWorkspace
    :is(
        .studio-header,
        .studio-head,
        .studio-heading,
        .studio-banner,
        .nsb-header,
        .nsw-toolbar,
        .nsw-preview-head,
        [class*="studio-header"],
        [class*="studio-head"],
        [class*="studio-banner"],
        [class*="studio-title"]
    ) {
        position:relative!important;
        top:auto!important;
        bottom:auto!important;
        inset-block:auto!important;
        transform:none!important;
        z-index:auto!important;
        max-width:100%!important;
        box-sizing:border-box!important;
    }

    /* =====================================
       4. LARGER VERTICAL PREVIEW
       ===================================== */

    html body #toolWorkspace
    :is(
        .video-preview-panel,
        .image-preview-panel,
        .tool-preview-panel,
        .nsw-preview
    ) {
        position:relative!important;
        inset:auto!important;
        width:100%!important;
        min-width:0!important;
        height:auto!important;
        max-height:none!important;
        overflow:visible!important;
        z-index:auto!important;
        align-self:start!important;
    }

    html body #toolWorkspace
    :is(
        #videoPlayerStage,
        #imagePreviewStage,
        .video-player-stage,
        .image-preview-stage
    ) {
        width:100%!important;
        min-width:0!important;
        min-height:320px!important;
        min-height:clamp(320px,55svh,620px)!important;
        max-height:none!important;
        box-sizing:border-box!important;
    }

    /* Preserve original media proportions */

    html body #toolWorkspace
    :is(
        #videoPreview,
        #videoCanvas,
        #imagePreview,
        #imageCanvas,
        #previewCanvas,
        #nsbLiveCanvas
    ) {
        max-width:100%!important;
        max-height:55vh!important;
        max-height:55svh!important;
        object-fit:contain!important;
    }

    /* =====================================
       5. ACTION BUTTONS IN NORMAL FLOW
       ===================================== */

    html body #toolWorkspace
    :is(
        .video-action-stack,
        .image-action-stack,
        .tool-action-stack,
        .nsw-actions
    ) {
        position:relative!important;
        inset:auto!important;
        transform:none!important;
        width:100%!important;
        height:auto!important;
        max-height:none!important;
        z-index:auto!important;
    }

    html body #toolWorkspace
    :is(
        #videoProcessButton,
        #processButton,
        #imageProcessButton
    ) {
        position:relative!important;
        inset:auto!important;
        transform:none!important;
        max-width:100%!important;
        min-height:50px!important;
        box-sizing:border-box!important;
        touch-action:manipulation;
    }

    /* =====================================
       6. STORYBOARD PREVIEW
       ===================================== */

    html body #nsbLivePanel {
        position:relative!important;
        inset:auto!important;
        max-height:none!important;
        overflow:visible!important;
    }

    html body #nsbLiveCanvas:not([hidden]) {
        max-height:55svh!important;
        object-fit:contain!important;
    }

    /* =====================================
       7. FORM READABILITY AND SAFARI
       ===================================== */

    html body #toolWorkspace
    :is(
        select,
        input[type="number"],
        input[type="text"]
    ) {
        font-size:16px!important;
        max-width:100%!important;
        box-sizing:border-box!important;
    }

    html body #toolWorkspace
    :is(
        .studio-header,
        .studio-head,
        .studio-banner,
        .nsb-header
    ) :is(h2,h3,p,small,span) {
        opacity:1!important;
    }

    html body #toolWorkspace
    :is(
        .studio-header,
        .studio-head,
        .studio-banner,
        .nsb-header
    ) {
        overflow-wrap:anywhere;
    }

}

/* Short landscape mobile screens */

@media (max-width:767px)
and (orientation:landscape) {

    html body #toolWorkspace
    :is(
        #videoPlayerStage,
        #imagePreviewStage,
        .video-player-stage,
        .image-preview-stage
    ) {
        min-height:220px!important;
    }

}




/* NUJIZ MOBILE WORKSPACE V3 */

@media(max-width:767px){

    html body #toolWorkspace {

        --nmp-height:75vh;
        --nmp-height:75svh;

        min-width:0!important;
        height:auto!important;
        max-height:none!important;
        overflow:visible!important;
    }

    /* Actual image and video preview panels */

    html body #toolWorkspace
    :is(
        .preview-panel,
        .video-preview-panel,
        .image-preview-panel,
        .nsw-preview
    ){

        position:relative!important;
        inset:auto!important;

        width:100%!important;
        height:auto!important;
        min-width:0!important;
        max-height:none!important;

        overflow:visible!important;
        box-sizing:border-box!important;
        flex-shrink:0!important;
    }

    /* Actual image canvas stage */

    html body #toolWorkspace
    .preview-panel > .canvas-stage,

    html body #toolWorkspace
    .nsw-preview .canvas-stage,

    html body #toolWorkspace
    #videoPlayerStage,

    html body #toolWorkspace
    .video-preview-panel .video-player-stage {

        position:relative!important;

        width:100%!important;
        height:var(--nmp-height)!important;
        min-height:var(--nmp-height)!important;
        max-height:none!important;

        padding:8px!important;
        box-sizing:border-box!important;

        display:grid;
        place-items:center!important;

        flex-shrink:0!important;
        align-self:stretch!important;
    }

    /* Do not reveal hidden media */

    html body #toolWorkspace
    .canvas-stage #previewCanvas,

    html body #toolWorkspace
    .video-player-stage #videoPreview,

    html body #toolWorkspace
    .video-player-stage #videoCanvas {

        width:auto!important;
        height:auto!important;

        max-width:100%!important;
        max-height:calc(
            var(--nmp-height) - 16px
        )!important;

        min-width:0!important;
        min-height:0!important;

        object-fit:contain!important;
        box-sizing:border-box!important;
    }

    /* Preserve hidden storyboard original player */

    html body #toolWorkspace
    #videoPlayerStage.nsb-hide-original {

        display:none!important;
    }

    /* Storyboard live preview */

    html body #toolWorkspace #nsbLivePanel {

        height:auto!important;
        max-height:none!important;
        overflow:visible!important;
    }

    html body #toolWorkspace
    #nsbLiveCanvas:not([hidden]) {

        width:auto!important;
        height:auto!important;
        max-width:100%!important;
        max-height:var(--nmp-height)!important;
        margin-inline:auto!important;
        object-fit:contain!important;
    }

    /* Settings columns */

    html body #toolWorkspace
    :is(
        .controls-panel,
        .video-controls-panel,
        .nsw-controls,
        .control-list,
        #dynamicControls,
        #videoDynamicControls
    ){

        position:relative!important;
        inset:auto!important;

        height:auto!important;
        max-height:none!important;
        min-width:0!important;

        overflow:visible!important;
        box-sizing:border-box!important;
    }

    /* Studio headings must not float over settings */

    html body #toolWorkspace
    .nsw-controls
    :is(
        header,
        .studio-title,
        .studio-header,
        .studio-head,
        .nsb-header,
        [class*="studio-header"],
        [class*="studio-head"],
        [class*="studio-banner"]
    ){

        position:relative!important;
        inset:auto!important;
        transform:none!important;
        z-index:auto!important;
    }

    /* Processing and download actions */

    html body #toolWorkspace
    :is(
        .action-stack,
        .video-action-stack,
        .nsw-actions
    ){

        position:relative!important;
        inset:auto!important;
        transform:none!important;
        z-index:auto!important;

        height:auto!important;
        max-height:none!important;
    }

    /* Preserve manual collapse */

    html body #toolWorkspace
    .nsw-collapsed > .nsw-preview
    :is(
        .canvas-stage,
        .video-player-stage,
        #nsbLivePanel
    ){

        display:none!important;
    }
}

@media(max-width:767px)
and (orientation:landscape){

    html body #toolWorkspace {

        --nmp-height:65vh;
        --nmp-height:65svh;
    }
}
