/* ============================================================
   SmokeDonalds — Home + Catalog Mobile V141
   Финальный mobile override. Десктоп не меняет.
   ============================================================ */

body.site-home-modern .home-feature-tile-v5 > .sd-feature-mobile-v141 {
    display: none !important;
}

@media (max-width: 820px) {
    html,
    body.site-home-modern,
    body.site-catalog-modern {
        max-width: 100% !important;
        overflow-x: clip !important;
    }

    body.site-home-modern *,
    body.site-catalog-modern * {
        box-sizing: border-box;
    }

    /* ---------- общие shell ---------- */
    body.site-home-modern .home-feature-pair-v5,
    body.site-home-modern .home-category-slider-v6,
    body.site-home-modern .home-popular-v7,
    body.site-home-modern .home-stores-v106,
    body.site-catalog-modern .catalog-modern-page.shell {
        width: calc(100% - 20px) !important;
        max-width: none !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* ---------- Франшиза / Мерч: отдельные mobile images ---------- */
    body.site-home-modern .sd-feature-mobile-v141 {
        display: none !important;
    }

    body.site-home-modern .home-feature-pair-v5 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 16px 0 8px !important;
    }

    body.site-home-modern .home-feature-tile-v5 {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
        min-height: 0 !important;
        border-radius: 16px !important;
        overflow: hidden !important;
    }

    body.site-home-modern .home-feature-tile-v5 > .sd-feature-desktop-v141 {
        display: none !important;
    }

    body.site-home-modern .home-feature-tile-v5 > .sd-feature-mobile-v141 {
        display: block !important;
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        transform: none !important;
    }

    body.site-home-modern .home-feature-copy-v5 {
        left: 16px !important;
        right: 16px !important;
        bottom: 14px !important;
    }

    /* ---------- мини-слайдеры: только целые карточки ---------- */
    body.site-home-modern .home-category-stage-v6,
    body.site-home-modern .home-popular-stage-v7,
    body.site-home-modern .home-stores-v106 {
        min-width: 0 !important;
        overflow: visible !important;
    }

    body.site-home-modern .home-category-viewport-v6,
    body.site-home-modern .home-popular-viewport-v7,
    body.site-home-modern .home-stores-grid-v106 {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        overscroll-behavior-x: contain !important;
        scroll-snap-type: x mandatory !important;
        scroll-padding: 0 !important;
        scrollbar-width: none !important;
    }

    body.site-home-modern .home-category-viewport-v6::-webkit-scrollbar,
    body.site-home-modern .home-popular-viewport-v7::-webkit-scrollbar,
    body.site-home-modern .home-stores-grid-v106::-webkit-scrollbar {
        display: none !important;
    }

    body.site-home-modern .home-category-track-v6,
    body.site-home-modern .home-popular-track-v7 {
        display: flex !important;
        width: max-content !important;
        min-width: 100% !important;
        gap: 10px !important;
        padding: 2px 0 6px !important;
        transform: none !important;
    }

    body.site-home-modern .home-category-card-v6,
    body.site-home-modern .home-popular-card-v7 {
        scroll-snap-align: start !important;
        scroll-snap-stop: always !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    body.site-home-modern .home-category-card-v6 {
        flex: 0 0 calc((100vw - 30px) / 2) !important;
        width: calc((100vw - 30px) / 2) !important;
        height: 250px !important;
    }

    body.site-home-modern .home-popular-card-v7 {
        flex: 0 0 calc((100vw - 30px) / 2) !important;
        width: calc((100vw - 30px) / 2) !important;
        height: 238px !important;
    }

    body.site-home-modern .home-category-nav-v6,
    body.site-home-modern .home-popular-nav-v7,
    body.site-home-modern .home-stores-nav-v106-1 {
        display: none !important;
    }

    body.site-home-modern .home-category-dots-v6,
    body.site-home-modern .home-popular-dots-v7 {
        margin-top: 8px !important;
    }

    /* ---------- магазины/город: 1 полная карточка на телефоне ---------- */
    body.site-home-modern .home-stores-grid-v106 {
        display: flex !important;
        gap: 10px !important;
        grid-template-columns: none !important;
        padding-bottom: 6px !important;
    }

    body.site-home-modern .home-stores-grid-v106 > .home-store-card-v106:not([hidden]):not(.is-hidden-by-city-v106-2) {
        display: grid !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        scroll-snap-align: start !important;
        scroll-snap-stop: always !important;
    }

    /* ---------- catalog main ---------- */
    body.site-catalog-modern .catalog-modern-page {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 34px !important;
        min-width: 0 !important;
    }

    body.site-catalog-modern .catalog-folders-v129 .section-head,
    body.site-catalog-modern .catalog-folders-v129 .catalog-folder-grid-v129 {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.site-catalog-modern .catalog-folders-v129 .catalog-folder-grid-v129 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    body.site-catalog-modern .catalog-folder-grid-v129 > .catalog-flip-card-v129 {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        aspect-ratio: .78 !important;
        overflow: hidden !important;
        border-radius: 15px !important;
    }

    body.site-catalog-modern .catalog-flip-inner-v129,
    body.site-catalog-modern .catalog-flip-face-v129,
    body.site-catalog-modern .catalog-flip-front-v129,
    body.site-catalog-modern .catalog-flip-back-v129 {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        min-width: 0 !important;
    }

    body.site-catalog-modern .catalog-flip-front-image-v129,
    body.site-catalog-modern .catalog-category-theme-image-v73 {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    body.site-catalog-modern .catalog-flip-front-caption-v129 strong {
        max-width: calc(100% - 52px) !important;
        overflow-wrap: anywhere !important;
    }

    body.site-catalog-modern .catalog-flip-back-content-v129 {
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        padding: 14px !important;
        min-width: 0 !important;
    }

    body.site-catalog-modern .catalog-flip-tree-scroll-v129 {
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* ---------- category products V138 ---------- */
    body.site-catalog-modern .catalog-category-shop-v138,
    body.site-catalog-modern .catalog-category-shop-layout-v138,
    body.site-catalog-modern .catalog-category-results-v138,
    body.site-catalog-modern .catalog-category-products-v138,
    body.site-catalog-modern .catalog-filter-product-shell-v138,
    body.site-catalog-modern .catalog-filter-product-shell-v138 .product-card {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    body.site-catalog-modern .catalog-category-shop-head-v138 {
        margin-bottom: 10px !important;
        gap: 10px !important;
    }

    body.site-catalog-modern .catalog-category-shop-head-v138 h1 {
        font-size: clamp(22px, 7vw, 30px) !important;
        line-height: 1.02 !important;
        overflow-wrap: anywhere !important;
    }

    body.site-catalog-modern .catalog-category-toolbar-v138 {
        width: 100% !important;
        min-width: 0 !important;
        gap: 8px !important;
        padding: 9px 10px !important;
        border-radius: 14px !important;
    }

    body.site-catalog-modern .catalog-filter-panel-v138 {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-width: none !important;
        max-height: min(82svh, 720px) !important;
        border-radius: 20px !important;
    }

    body.site-catalog-modern .catalog-filter-product-shell-v138 .product-card {
        overflow: hidden !important;
    }
}

@media (max-width: 700px) {
    /* ---------- mobile header ---------- */
    html[data-site-theme] body.site-home-modern .topbar,
    html[data-site-theme] body.site-catalog-modern .topbar {
        overflow: visible !important;
        z-index: 6000 !important;
    }

    html[data-site-theme] body.site-home-modern .topbar .shell.home-nav-v1,
    html[data-site-theme] body.site-catalog-modern .topbar .shell.home-nav-v1 {
        width: calc(100% - 16px) !important;
        max-width: none !important;
        min-height: 104px !important;
        padding: 7px 0 !important;
        grid-template-columns: 92px 42px minmax(0, 1fr) 40px 40px !important;
        grid-template-rows: 48px 35px !important;
        column-gap: 5px !important;
        row-gap: 5px !important;
        transform: none !important;
        overflow: visible !important;
    }

    html[data-site-theme] body.site-home-modern .home-logo-v1,
    html[data-site-theme] body.site-catalog-modern .home-logo-v1 {
        width: 92px !important;
        min-width: 92px !important;
        max-width: 92px !important;
        height: 46px !important;
    }

    html[data-site-theme] body.site-home-modern .home-logo-v1 img,
    html[data-site-theme] body.site-catalog-modern .home-logo-v1 img {
        width: 90px !important;
        max-width: 90px !important;
        height: 44px !important;
        object-fit: contain !important;
    }

    html[data-site-theme] body.site-home-modern .home-catalog-v1,
    html[data-site-theme] body.site-catalog-modern .home-catalog-v1 {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        font-size: 0 !important;
        border-radius: 12px !important;
    }

    html[data-site-theme] body.site-home-modern .home-city-v1,
    html[data-site-theme] body.site-catalog-modern .home-city-v1 {
        width: 100% !important;
        min-width: 0 !important;
        height: 42px !important;
        padding: 0 8px !important;
        gap: 5px !important;
        overflow: hidden !important;
    }

    html[data-site-theme] body.site-home-modern .home-city-v1 b,
    html[data-site-theme] body.site-catalog-modern .home-city-v1 b {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 10px !important;
    }

    html[data-site-theme] body.site-home-modern .site-theme-toggle-v33,
    html[data-site-theme] body.site-home-modern .home-account-v1,
    html[data-site-theme] body.site-catalog-modern .site-theme-toggle-v33,
    html[data-site-theme] body.site-catalog-modern .home-account-v1 {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
    }

    html[data-site-theme] body.site-home-modern .home-links-v1,
    html[data-site-theme] body.site-catalog-modern .home-links-v1 {
        grid-area: links !important;
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 5px !important;
    }

    html[data-site-theme] body.site-home-modern .home-links-v1 > *,
    html[data-site-theme] body.site-catalog-modern .home-links-v1 > * {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 35px !important;
        padding: 0 5px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 9px !important;
    }

    /* ---------- исправление каталога из шапки ---------- */
    html[data-site-theme] body.site-home-modern #catalogPanel.catalog-panel,
    html[data-site-theme] body.site-catalog-modern #catalogPanel.catalog-panel {
        display: none !important;
        position: fixed !important;
        top: 104px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: auto !important;
        padding: 7px 8px max(8px, env(safe-area-inset-bottom)) !important;
        z-index: 5990 !important;
        overflow: hidden !important;
        background: rgba(0,0,0,.34) !important;
        backdrop-filter: blur(5px) !important;
        -webkit-backdrop-filter: blur(5px) !important;
        pointer-events: none !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel.catalog-panel.active,
    html[data-site-theme] body.site-catalog-modern #catalogPanel.catalog-panel.active {
        display: block !important;
        pointer-events: auto !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-panel-inner,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-panel-inner {
        width: 100% !important;
        max-width: none !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-dropdown,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-dropdown {
        width: 100% !important;
        max-width: none !important;
        height: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain !important;
        border-radius: 18px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* На телефоне каталог — один вертикальный список, без hover-панелей справа. */
    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-hover-panel,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-hover-panel {
        display: none !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-branch,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-branch {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-sublist,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-sublist {
        display: block !important;
        position: static !important;
        inset: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        border: 0 !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-item,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-item {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 58px !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-branch.level-1 > .catalog-item,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-branch.level-1 > .catalog-item {
        padding-left: 18px !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-branch.level-2 > .catalog-item,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-branch.level-2 > .catalog-item {
        padding-left: 28px !important;
    }

    html[data-site-theme] body.site-home-modern #catalogPanel .catalog-branch.level-3 > .catalog-item,
    html[data-site-theme] body.site-catalog-modern #catalogPanel .catalog-branch.level-3 > .catalog-item {
        padding-left: 38px !important;
    }

    body.catalog-open {
        overflow: hidden !important;
    }

    body.catalog-open #catalogPanel .catalog-dropdown {
        touch-action: pan-y;
    }

    /* ---------- hero ---------- */
    body.site-home-modern .hero.home-hero-v4 {
        width: 100% !important;
        max-width: 100% !important;
        height: min(680px, 100svh) !important;
        min-height: 590px !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    body.site-home-modern .home-hero-copy-v4 {
        left: 14px !important;
        right: 14px !important;
        width: auto !important;
        bottom: 54px !important;
    }

    body.site-home-modern .home-hero-copy-v4 h1 {
        max-width: 100% !important;
        font-size: clamp(34px, 11vw, 50px) !important;
        line-height: .96 !important;
        overflow-wrap: anywhere !important;
    }

    body.site-home-modern .home-hero-search-v4,
    body.site-home-modern .home-hero-search-shell-v4 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ---------- section heads ---------- */
    body.site-home-modern .home-category-head-v6,
    body.site-home-modern .home-popular-head-v7,
    body.site-home-modern .home-stores-head-v106 {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        gap: 8px !important;
    }

    body.site-home-modern .home-category-head-v6 h2,
    body.site-home-modern .home-popular-head-v7 h2,
    body.site-home-modern .home-stores-head-v106 h2 {
        font-size: clamp(22px, 7vw, 30px) !important;
        line-height: 1 !important;
    }
}

@media (max-width: 520px) {
    body.site-home-modern .home-category-card-v6,
    body.site-home-modern .home-popular-card-v7 {
        flex-basis: 100% !important;
        width: 100% !important;
        min-width: 100% !important;
    }

    body.site-home-modern .home-category-card-v6 {
        height: 300px !important;
    }

    body.site-home-modern .home-popular-card-v7 {
        height: 270px !important;
    }

    body.site-home-modern .home-popular-media-v7 {
        height: 170px !important;
        min-height: 170px !important;
    }

    body.site-catalog-modern .catalog-folders-v129 .catalog-folder-grid-v129 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    body.site-catalog-modern .catalog-folder-grid-v129 > .catalog-flip-card-v129 {
        aspect-ratio: .82 !important;
        min-height: 390px !important;
    }

    body.site-catalog-modern .catalog-flip-back-content-v129 {
        padding: 16px !important;
    }
}

@media (max-width: 390px) {
    html[data-site-theme] body.site-home-modern .topbar .shell.home-nav-v1,
    html[data-site-theme] body.site-catalog-modern .topbar .shell.home-nav-v1 {
        width: calc(100% - 12px) !important;
        grid-template-columns: 82px 38px minmax(0, 1fr) 38px 38px !important;
        column-gap: 4px !important;
    }

    html[data-site-theme] body.site-home-modern .home-logo-v1,
    html[data-site-theme] body.site-catalog-modern .home-logo-v1 {
        width: 82px !important;
        min-width: 82px !important;
        max-width: 82px !important;
    }

    html[data-site-theme] body.site-home-modern .home-logo-v1 img,
    html[data-site-theme] body.site-catalog-modern .home-logo-v1 img {
        width: 80px !important;
        max-width: 80px !important;
    }

    html[data-site-theme] body.site-home-modern .home-catalog-v1,
    html[data-site-theme] body.site-catalog-modern .home-catalog-v1,
    html[data-site-theme] body.site-home-modern .site-theme-toggle-v33,
    html[data-site-theme] body.site-home-modern .home-account-v1,
    html[data-site-theme] body.site-catalog-modern .site-theme-toggle-v33,
    html[data-site-theme] body.site-catalog-modern .home-account-v1 {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
    }
}
