/* Mobile application shell. Desktop presentation remains driven by app.css. */
.mobile-bottom-nav,
.app-header-actions,
.mobile-drawer-head,
.mobile-drawer-label,
.mobile-nav-backdrop,
.mobile-filter-trigger,
.mobile-filter-head,
.mobile-filter-backdrop,
.mobile-product-bar {
    display: none;
}

.connection-banner {
    position: fixed;
    z-index: 170;
    inset: 76px 20px auto;
    padding: 10px 14px;
    border: 1px solid #6d5326;
    border-radius: 10px;
    background: #2a2112;
    color: #f5d995;
    text-align: center;
    font-size: .82rem;
    box-shadow: var(--shadow);
}

.connection-banner[hidden] { display: none; }

@media (max-width: 820px) {
    :root {
        --app-header-height: 64px;
        --app-nav-height: 70px;
        --app-inline: 16px;
        --radius: 18px;
    }

    html {
        scroll-padding-top: calc(var(--app-header-height) + env(safe-area-inset-top));
        -webkit-tap-highlight-color: transparent;
    }

    body.app-shell {
        min-width: 0;
        padding-bottom: calc(var(--app-nav-height) + env(safe-area-inset-bottom));
        overscroll-behavior-y: contain;
        background: #090b0f;
    }

    body.nav-open,
    body.filter-open { overflow: hidden; }

    .container { width: calc(100% - (var(--app-inline) * 2)); }
    .section { padding: 46px 0; }
    .section.compact { padding: 30px 0 42px; }
    .section-head { gap: 8px; margin-bottom: 22px; }
    .section-head h2 { font-size: 1.65rem; }
    .section-head p { font-size: .92rem; }
    .section-head > a { min-height: 44px; display: inline-flex; align-items: center; }

    .site-header {
        height: calc(var(--app-header-height) + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
        background: rgba(9, 11, 15, .96);
        border-bottom-color: rgba(255, 255, 255, .08);
        backdrop-filter: blur(18px);
    }

    .nav-wrap {
        width: 100%;
        height: var(--app-header-height);
        padding: 0 12px;
        gap: 8px;
    }

    .nav-toggle {
        order: 0;
        display: grid !important;
        place-content: center;
        flex: 0 0 46px;
        width: 46px;
        height: 46px;
        margin: 0;
        padding: 11px;
        border-radius: 50%;
    }

    .nav-toggle:active,
    .app-header-actions a:active,
    .mobile-bottom-nav a:active { background: rgba(255, 255, 255, .09); }

    .nav-toggle span:not(.sr-only) {
        width: 21px;
        height: 2px;
        margin: 2.5px 0;
        border-radius: 2px;
    }

    .brand {
        order: 1;
        min-width: 0;
        flex: 1;
        gap: 0;
        font-size: .86rem;
        line-height: 1.15;
        overflow: hidden;
    }

    .site-header .brand > img { display: none; }
    .site-header .brand span {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .site-header .brand b { display: inline; }

    .app-header-actions {
        order: 2;
        display: flex;
        align-items: center;
        gap: 2px;
    }

    .app-header-actions a {
        display: grid;
        place-items: center;
        width: 46px;
        height: 46px;
        border-radius: 50%;
    }

    .app-header-actions svg,
    .mobile-bottom-nav svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .nav-actions { display: none; }

    .main-nav {
        position: fixed !important;
        z-index: 152;
        inset: 0 auto 0 0 !important;
        display: flex !important;
        width: min(86vw, 350px);
        height: 100dvh;
        margin: 0;
        padding: calc(12px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom));
        gap: 2px;
        flex-direction: column;
        border: 0;
        border-right: 1px solid var(--border);
        border-radius: 0;
        background: #11151b;
        box-shadow: 24px 0 80px rgba(0, 0, 0, .48);
        overflow-y: auto;
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s;
    }

    .main-nav.open {
        transform: translateX(0);
        visibility: visible;
    }

    .mobile-drawer-head {
        display: flex;
        min-height: 54px;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        padding: 0 4px 12px;
        border-bottom: 1px solid var(--border);
        font-weight: 800;
    }

    .mobile-drawer-head span { display: flex; align-items: center; gap: 10px; }
    .mobile-drawer-head button {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border: 0;
        border-radius: 50%;
        background: transparent;
        font-size: 1.65rem;
    }

    .mobile-drawer-label {
        display: block;
        margin: 14px 12px 5px;
        color: #747c88;
        font-size: .68rem;
        font-weight: 800;
        letter-spacing: .13em;
        text-transform: uppercase;
    }

    .main-nav a {
        display: flex;
        min-height: 48px;
        align-items: center;
        padding: 10px 14px;
        border-radius: 12px;
        color: #e6e8ec;
        font-size: .94rem;
    }

    .main-nav a.active { background: rgba(213, 168, 75, .12); color: var(--gold-2); }
    .install-app-button {
        min-height: 50px;
        margin: 18px 4px 0;
        border: 1px solid #6b572f;
        border-radius: 13px;
        background: rgba(213, 168, 75, .1);
        color: var(--gold-2);
        font-weight: 800;
    }

    .mobile-nav-backdrop {
        position: fixed;
        z-index: 151;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, .66);
        backdrop-filter: blur(2px);
    }

    .mobile-nav-backdrop[hidden] { display: none; }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 140;
        inset: auto 0 0;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: calc(var(--app-nav-height) + env(safe-area-inset-bottom));
        padding: 5px 5px env(safe-area-inset-bottom);
        border-top: 1px solid rgba(255, 255, 255, .1);
        background: rgba(15, 18, 24, .97);
        box-shadow: 0 -10px 35px rgba(0, 0, 0, .28);
        backdrop-filter: blur(18px);
    }

    .mobile-bottom-nav a {
        position: relative;
        display: flex;
        min-width: 0;
        min-height: 60px;
        align-items: center;
        justify-content: center;
        gap: 2px;
        flex-direction: column;
        border-radius: 14px;
        color: #8f96a1;
        font-size: .64rem;
        font-weight: 700;
        line-height: 1;
    }

    .mobile-bottom-nav a::before {
        content: "";
        position: absolute;
        top: 4px;
        width: 44px;
        height: 30px;
        border-radius: 99px;
        background: transparent;
        z-index: -1;
    }

    .mobile-bottom-nav a.active { color: var(--gold-2); }
    .mobile-bottom-nav a.active::before { background: rgba(213, 168, 75, .14); }
    .mobile-nav-icon { position: relative; display: grid; place-items: center; }
    .mobile-nav-icon b {
        position: absolute;
        top: -7px;
        right: -10px;
        display: grid;
        min-width: 17px;
        height: 17px;
        place-items: center;
        padding: 0 4px;
        border: 2px solid #0f1218;
        border-radius: 99px;
        background: var(--gold);
        color: #08090b;
        font-size: .58rem;
    }

    .connection-banner {
        inset: calc(var(--app-header-height) + env(safe-area-inset-top) + 8px) var(--app-inline) auto;
        border-radius: 14px;
    }

    .toast {
        top: auto;
        right: var(--app-inline);
        bottom: calc(var(--app-nav-height) + env(safe-area-inset-bottom) + 12px);
        left: var(--app-inline);
        max-width: none;
        border-radius: 14px;
        animation-name: mobile-toast-in;
    }

    .btn {
        min-height: 52px;
        border-radius: 14px;
        padding: 12px 18px;
    }

    .btn.small { min-height: 44px; }
    button:active, .btn:active { transform: scale(.98); }
    input, select, textarea { font-size: 16px !important; }
    .input, select, textarea,
    input[type=text], input[type=email], input[type=password],
    input[type=number], input[type=date], input[type=file], input[type=search] {
        min-height: 52px;
        border-radius: 13px;
        padding: 12px 14px;
    }

    .hero {
        min-height: calc(100svh - var(--app-nav-height));
        height: auto;
        padding: calc(var(--app-header-height) + env(safe-area-inset-top) + 56px) 0 48px;
        align-items: end;
        background-position: 62% center;
    }

    .hero::before {
        background: linear-gradient(0deg, #090b0f 2%, rgba(9, 11, 15, .88) 48%, rgba(9, 11, 15, .33)),
                    linear-gradient(90deg, rgba(9, 11, 15, .6), transparent);
    }

    .hero-content { padding-top: 0; }
    .hero h1 { max-width: 12ch; font-size: clamp(2.55rem, 12vw, 4.2rem); }
    .hero .lead { max-width: 39ch; font-size: .98rem; }
    .hero .button-row { display: grid; margin: 24px 0 32px; }
    .hero .button-row .btn { width: 100%; }
    .hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .hero-facts div { padding: 12px 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(16,19,24,.6); }
    .hero-facts strong { font-size: 1rem; }
    .hero-facts span { font-size: .58rem; line-height: 1.3; }

    .page-hero {
        padding: calc(var(--app-header-height) + env(safe-area-inset-top) + 32px) 0 25px;
        background: radial-gradient(circle at 85% 20%, rgba(213, 168, 75, .13), transparent 42%);
    }

    .page-hero h1 { font-size: clamp(2rem, 10vw, 3.2rem); }
    .page-hero p { font-size: .93rem; margin-bottom: .45em; }
    .page-hero .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .footage-card {
        border-radius: 16px;
        background: #11151a;
    }
    .footage-card:hover { transform: none; box-shadow: none; }
    .card-body { padding: 13px; }
    .card-body h3 { min-height: 2.35em; margin: .25em 0 .55em; font-size: .95rem; }
    .card-meta { gap: 6px; align-items: start; flex-direction: column; }
    .card-meta strong { text-align: left; }

    body.route-home .footage-grid,
    body.route-home .collection-grid,
    body.route-home .category-grid,
    body.route-home .testimonial-grid {
        width: calc(100% + var(--app-inline));
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: min(82vw, 330px);
        grid-template-columns: none;
        gap: 14px;
        padding-right: var(--app-inline);
        padding-bottom: 8px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: inline mandatory;
        scrollbar-width: none;
    }

    body.route-home .footage-grid::-webkit-scrollbar,
    body.route-home .collection-grid::-webkit-scrollbar,
    body.route-home .category-grid::-webkit-scrollbar,
    body.route-home .testimonial-grid::-webkit-scrollbar { display: none; }

    body.route-home .footage-grid > *,
    body.route-home .collection-grid > *,
    body.route-home .category-grid > *,
    body.route-home .testimonial-grid > * { scroll-snap-align: start; }

    .feature-grid, .steps-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .feature, .step { min-width: 0; padding: 18px 15px; }
    .feature h3, .step h3 { font-size: 1rem; }
    .feature p, .step p { font-size: .82rem; }
    .step::before { margin-bottom: 18px; }
    .newsletter { padding: 24px 18px; border-radius: 20px; gap: 22px; }
    .inline-form { display: grid; }

    .site-footer { display: none; }

    /* Catalog filter behaves like an Android bottom sheet. */
    .route-katalog .content-layout { display: block; }
    .route-katalog .filter-panel {
        position: fixed;
        z-index: 161;
        inset: auto 0 0;
        max-height: min(88dvh, 760px);
        padding: 0 18px calc(22px + env(safe-area-inset-bottom));
        border: 0;
        border-top: 1px solid var(--border);
        border-radius: 24px 24px 0 0;
        overflow-y: auto;
        background: #13171d;
        box-shadow: 0 -25px 80px rgba(0,0,0,.58);
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s;
    }

    .route-katalog.filter-open .filter-panel { transform: translateY(0); visibility: visible; }
    .mobile-filter-head {
        position: sticky;
        z-index: 2;
        top: 0;
        display: flex;
        min-height: 64px;
        align-items: center;
        justify-content: space-between;
        margin: 0 -4px 16px;
        border-bottom: 1px solid var(--border);
        background: #13171d;
    }
    .mobile-filter-head::before {
        content: "";
        position: absolute;
        top: 7px;
        left: 50%;
        width: 42px;
        height: 4px;
        border-radius: 9px;
        background: #4b515b;
        transform: translateX(-50%);
    }
    .mobile-filter-head strong { padding-top: 8px; }
    .mobile-filter-head button {
        width: 44px;
        height: 44px;
        margin-top: 8px;
        border: 0;
        border-radius: 50%;
        background: transparent;
        font-size: 1.5rem;
    }
    .mobile-filter-backdrop {
        position: fixed;
        z-index: 160;
        inset: 0;
        display: block;
        background: rgba(0,0,0,.66);
        backdrop-filter: blur(2px);
    }
    .mobile-filter-backdrop[hidden] { display: none; }
    .results-head { gap: 12px; align-items: center; margin-bottom: 16px; font-size: .8rem; }
    .results-head > span:last-of-type { display: none; }
    .mobile-filter-trigger {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
        gap: 7px;
        padding: 8px 13px;
        border: 1px solid #6a5731;
        border-radius: 99px;
        background: rgba(213,168,75,.1);
        color: var(--gold-2);
        font-weight: 800;
    }
    .route-katalog .footage-grid,
    .route-katalog .footage-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .route-katalog .media-badge { max-width: calc(100% - 60px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .route-katalog .pagination { margin-top: 28px; }

    /* Product detail prioritizes preview and keeps the primary action in thumb range. */
    .route-footage { padding-bottom: calc(var(--app-nav-height) + 82px + env(safe-area-inset-bottom)) !important; }
    .route-footage .product-layout { gap: 22px; }
    .route-footage .product-preview { order: 0; }
    .route-footage .product-info { order: 1; }
    .route-footage .product-preview .help { margin: 8px 2px 0; }
    .route-footage .product-info h1 { font-size: 2rem; }
    .route-footage .product-price { margin: 18px 0; }
    .license-option { min-height: 76px; padding: 14px 12px; }
    .license-option small { font-size: .75rem; }
    .product-actions { grid-template-columns: 1fr; }
    .metadata { grid-template-columns: repeat(2, 1fr); margin-top: 28px; }
    .metadata div { padding: 14px 7px; }
    .mobile-product-bar {
        position: fixed;
        z-index: 130;
        right: 0;
        bottom: calc(var(--app-nav-height) + env(safe-area-inset-bottom));
        left: 0;
        display: grid;
        grid-template-columns: minmax(0, .8fr) minmax(150px, 1.2fr);
        gap: 12px;
        align-items: center;
        min-height: 78px;
        padding: 9px var(--app-inline);
        border-top: 1px solid var(--border);
        background: rgba(15,18,24,.98);
        box-shadow: 0 -10px 35px rgba(0,0,0,.3);
        backdrop-filter: blur(18px);
    }
    .mobile-product-bar span { display: grid; min-width: 0; color: var(--muted); font-size: .65rem; line-height: 1.2; }
    .mobile-product-bar strong { overflow: hidden; color: var(--text); font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-product-bar .btn { width: 100%; min-height: 52px; padding-inline: 12px; }

    .panel { padding: 18px; }
    .split-page { gap: 18px; }
    .cart-item { grid-template-columns: 86px 1fr; gap: 13px; }
    .cart-item > div:last-child { grid-column: 2; }
    .account-nav {
        margin-right: calc(var(--app-inline) * -1);
        flex-wrap: nowrap;
        padding-right: var(--app-inline);
        overflow-x: auto;
        scrollbar-width: none;
    }
    .account-nav::-webkit-scrollbar { display: none; }
    .account-nav a { flex: 0 0 auto; min-height: 44px; display: inline-flex; align-items: center; border-radius: 99px; }
    .stat-grid { grid-template-columns: repeat(3, minmax(110px, 1fr)); overflow-x: auto; }
    .stat-card { padding: 18px; }
    .table-wrap { border-radius: 16px; }

    .video-modal { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); align-items: end; }
    .video-dialog { width: 100%; border-width: 1px 0 0; border-radius: 24px 24px 0 0; }
    .modal-head { height: 62px; }

    .auth-shell {
        min-height: calc(100svh - var(--app-nav-height));
        padding: calc(var(--app-header-height) + env(safe-area-inset-top) + 28px) var(--app-inline) 32px;
    }
    .auth-card { padding: 25px 20px; border-radius: 22px; }
}

@media (max-width: 360px) {
    .site-header .brand { font-size: .78rem; }
    .app-header-actions a { width: 42px; }
    .hero h1 { font-size: 2.45rem; }
    .mobile-bottom-nav a { font-size: .6rem; }
    .route-katalog .footage-grid,
    .route-katalog .footage-grid.three { gap: 8px; }
    .route-katalog .card-body { padding: 11px 10px; }
    .route-katalog .card-body h3 { font-size: .86rem; }
}

@keyframes mobile-toast-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (display-mode: standalone) and (max-width: 820px) {
    .app-shell { user-select: none; }
    .app-shell input, .app-shell textarea, .app-shell .prose { user-select: text; }
}

@media (prefers-reduced-motion: reduce) {
    .main-nav, .route-katalog .filter-panel { transition: none; }
}
