.pb-subcats, .pb-subcats-dialog {
    --pb-navy: #151e52;
    --pb-ink: #141d4e;
    --pb-border: #dce3ee;
    --pb-muted: #56627b;
}

.pb-subcats-icons {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.pb-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.pb-subcats {
    container-type: inline-size;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px 16px;
    padding-bottom: 30px;
    border-bottom: 1px solid #b9c6dc;
    color: var(--pb-ink);
}

.subcategories_list_description.no-description:not(.has-sub) .pb-subcats {
    margin-top: 20px;
}

.pb-subcats ~ .description {
    margin-top: 24px;
}

.pb-subcats h2 {
    font-family: 'Pigu Bold', Arial, sans-serif;
    font-size: 25px;
    line-height: 1.3;
    letter-spacing: -0.4px;
    color: var(--pb-ink);
    margin: 0;
}

.pb-subcats-heading {
    grid-area: 1 / 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.pb-subcats-carousel {
    position: relative;
    grid-area: 2 / 1 / auto / -1;
    min-width: 0;
}

.pb-subcats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.pb-subcats-tile {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 9px;
    min-width: 0;
    min-height: 100px;
    text-align: left;
    text-decoration: none;
    color: var(--pb-ink);
    box-shadow: 0 2px 4px rgba(22, 32, 75, 0.01);
    transition: border-color 0.16s, background 0.16s, transform 0.16s;
}

.pb-subcats-tile:hover,
.pb-subcats-tile:focus {
    color: var(--pb-ink);
    text-decoration: none;
}

.pb-subcats-tile:nth-child(n+9) {
    display: none;
}

.pb-subcats-img {
    display: block;
    border-radius: 50%;
    overflow: hidden;
    background: #eef1f6;
    flex-shrink: 0;
}

.pb-subcats-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: multiply;
}

.pb-subcats-tile .pb-subcats-img {
    width: 66px;
    height: 66px;
}

.pb-subcats-name {
    font-family: 'Pigu Bold', Arial, sans-serif;
    font-size: 17px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

@media (hover: hover) {
    .pb-subcats-tile:hover {
        border-color: #8b9ab9;
        background: #f6f8ff;
        transform: translateY(-2px);
    }

    .pb-subcats-all:hover {
        background: #283575;
    }

    .pb-subcats-list a:hover {
        background: #f2f5fb;
    }
}

.pb-subcats-hint,
.pb-subcats-controls {
    display: none;
}

.pb-subcats-all {
    grid-area: 1 / 2;
    display: none;
    min-height: 52px;
    padding: 12px 18px;
    background: var(--pb-navy);
    color: #fff;
    border: 1px solid var(--pb-navy);
    border-radius: 7px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Pigu Bold', Arial, sans-serif;
    font-size: 17px;
    cursor: pointer;
    transition: background 0.16s;
}

.pb-subcats-all:focus,
.pb-subcats-all:focus-visible {
    outline: none;
}

.pb-subcats.has-more-desktop .pb-subcats-all {
    display: flex;
}

.pb-subcats-all .pb-icon {
    fill: currentColor;
    stroke-width: 0;
    width: 25px;
    height: 25px;
}

@container (max-width: 999px) {
    .pb-subcats-tile {
        padding: 12px 10px;
        gap: 10px;
        min-height: 90px;
    }

    .pb-subcats-tile .pb-subcats-img {
        width: 52px;
        height: 52px;
    }

    .pb-subcats-name {
        font-size: 14px;
        line-height: 1.25;
        overflow-wrap: normal;
    }
}

@media (min-width: 768px) and (max-width: 1000px) {
    .pb-subcats-tile {
        flex-direction: column;
        justify-content: flex-start;
        text-align: center;
        padding: 12px 8px;
        gap: 12px;
        min-height: 100px;
    }

    .pb-subcats-tile .pb-subcats-img {
        width: 66px;
        height: 66px;
    }

    .pb-subcats-name {
        font-size: 16px;
        line-height: 1.3;
    }
}

.pb-subcats-dialog {
    --pb-sheet-travel: 32px;
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    width: 540px;
    max-width: calc(100% - 32px);
    max-height: calc(100dvh - 64px);
    padding: 0;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    color: var(--pb-ink);
    background: #fff;
    box-shadow: 0 24px 90px rgba(17, 28, 75, 0.25);
    transform-origin: center bottom;
}

.pb-subcats-dialog:not([open]) {
    display: none;
}

.pb-subcats-dialog,
.pb-subcats-dialog:focus,
.pb-subcats-dialog :focus,
.pb-subcats-dialog :focus-visible {
    outline: none;
}

.pb-subcats-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: pb-sheet-in 440ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pb-subcats-dialog::backdrop {
    background: rgba(17, 25, 51, 0.54);
    backdrop-filter: blur(2px);
}

.pb-subcats-dialog[open]::backdrop {
    animation: pb-backdrop-in 300ms ease-out both;
}

.pb-subcats-dialog[open].is-closing {
    animation: pb-sheet-out 240ms cubic-bezier(0.4, 0, 1, 1) both;
    pointer-events: none;
}

.pb-subcats-dialog[open].is-closing::backdrop {
    animation: pb-backdrop-out 240ms ease-in both;
}

.pb-subcats-sheet-handle {
    display: none;
}

.pb-subcats-dialog-header {
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--pb-border);
    flex-shrink: 0;
    background: #fff;
}

.pb-subcats-dialog-header h2 {
    font-family: 'Pigu Bold', Arial, sans-serif;
    font-size: 27px;
    line-height: 1.3;
    letter-spacing: -0.4px;
    color: var(--pb-ink);
    margin: 12px 0 0;
}

.pb-subcats-back {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 0;
    min-height: 48px;
    padding: 8px 0;
    font-family: 'Pigu SemiBold', Arial, sans-serif;
    font-size: 18px;
    color: var(--pb-ink);
    cursor: pointer;
}

.pb-subcats-dialog-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 24px 20px;
    scrollbar-color: #9baac4 #fff;
    scrollbar-width: thin;
}

.pb-subcats-list a {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 80px;
    padding: 12px 0;
    border-bottom: 1px solid var(--pb-border);
    background: #fff;
    font-family: 'Pigu SemiBold', Arial, sans-serif;
    font-size: 18px;
    line-height: 1.35;
    color: var(--pb-ink);
    text-decoration: none;
}

.pb-subcats-list .pb-subcats-img {
    width: 54px;
    height: 54px;
}

.pb-subcats-label {
    flex: 1 1 0%;
}

.pb-subcats-list .pb-icon {
    width: 20px;
    color: #5e708e;
}

@keyframes pb-sheet-in {
    from { transform: translateY(var(--pb-sheet-travel)); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pb-sheet-out {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(var(--pb-sheet-travel)); opacity: 0; }
}

@keyframes pb-backdrop-in {
    from { background-color: rgba(17, 25, 51, 0); backdrop-filter: blur(0); }
    to { background-color: rgba(17, 25, 51, 0.54); backdrop-filter: blur(2px); }
}

@keyframes pb-backdrop-out {
    from { background-color: rgba(17, 25, 51, 0.54); backdrop-filter: blur(2px); }
    to { background-color: rgba(17, 25, 51, 0); backdrop-filter: blur(0); }
}

html.pb-subcats-locked {
    overflow: hidden;
}

@media (max-width: 767px) {
    .pb-subcats {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
        padding-bottom: 20px;
    }

    .pb-subcats ~ .description {
        margin-top: 16px;
    }

    .pb-subcats-heading {
        display: none;
    }

    .pb-subcats-title-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 44px;
        margin-bottom: 12px;
    }

    .subcategories_list_description .pb-subcats-title-row h1 {
        margin: 0;
        min-width: 0;
    }

    .pb-subcats-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: auto;
    }

    .pb-subcats-arrow {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid rgba(21, 30, 82, 0.16);
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.65);
        color: var(--pb-navy, #151e52);
        box-shadow: 0 2px 8px rgba(21, 30, 82, 0.12);
        cursor: pointer;
        transition: background 0.16s;
        -webkit-tap-highlight-color: transparent;
    }

    .pb-subcats-arrow:focus {
        outline: none;
    }

    .pb-subcats-arrow .pb-icon {
        width: 28px;
        height: 28px;
        stroke-width: 2.5;
    }

    .pb-subcats-arrow-prev .pb-icon {
        transform: rotate(180deg);
    }

    .pb-subcats-arrow:disabled {
        color: rgba(21, 30, 82, 0.35);
        background: rgba(255, 255, 255, 0.4);
        border-color: rgba(21, 30, 82, 0.09);
        box-shadow: none;
        cursor: default;
    }

    .pb-subcats-arrow:not(:disabled):active {
        background: rgba(255, 255, 255, 0.88);
    }

    .pb-subcats-carousel {
        grid-area: 1 / 1;
    }

    .pb-subcats-grid {
        --pb-gap: 6px;
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: calc((100% - 3 * var(--pb-gap)) / 4);
        gap: var(--pb-gap);
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
        scrollbar-color: #8594b4 #e8edf5;
        padding-bottom: 7px;
        touch-action: pan-x pan-y pinch-zoom;
    }

    .pb-subcats-tile,
    .pb-subcats-tile:nth-child(n+9) {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        text-align: center;
        padding: 9px 4px;
        gap: 9px;
        min-height: 134px;
        border-radius: 7px;
        scroll-snap-align: start;
        user-select: none;
        -webkit-user-select: none;
    }

    .pb-subcats-tile .pb-subcats-img {
        width: 58px;
        height: 58px;
        max-width: 100%;
        aspect-ratio: 1 / 1;
    }

    .pb-subcats-name {
        font-size: 13px;
        line-height: 1.25;
        overflow-wrap: break-word;
        word-break: normal;
        max-width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .pb-subcats.has-more-mobile .pb-subcats-hint {
        grid-area: 2 / 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        color: var(--pb-muted);
        font-size: 14px;
        line-height: 1.3;
        margin-top: -5px;
    }

    .pb-subcats-position {
        font-family: 'Pigu SemiBold', Arial, sans-serif;
        color: var(--pb-ink);
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .pb-subcats-all,
    .pb-subcats.has-more-desktop .pb-subcats-all {
        display: none;
    }

    .pb-subcats.has-more-mobile .pb-subcats-all {
        grid-area: 3 / 1;
        display: flex;
        width: 100%;
        font-size: 17px;
        min-height: 54px;
        padding: 11px 8px;
        gap: 10px;
    }

    .pb-subcats-all .pb-icon {
        width: 24px;
        height: 24px;
    }

    .pb-subcats-dialog {
        --pb-sheet-travel: calc(100% + 24px);
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        max-width: 100%;
        height: 92dvh;
        max-height: 92dvh;
        margin: 0;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -12px 48px rgba(9, 17, 45, 0.18);
    }

    .pb-subcats-sheet-handle {
        display: block;
        position: relative;
        flex-shrink: 0;
        height: 18px;
        cursor: grab;
        touch-action: none;
    }

    .pb-subcats-sheet-handle::before {
        content: "";
        position: absolute;
        top: 11px;
        left: 50%;
        width: 42px;
        height: 5px;
        margin-left: -21px;
        border-radius: 4px;
        background: #bcc3d0;
    }

    .pb-subcats-dialog-header {
        touch-action: none;
    }

    .pb-subcats-dialog.is-dragging .pb-subcats-sheet-handle {
        cursor: grabbing;
    }

    .pb-subcats-dialog-header {
        padding: 0 18px 16px;
    }

    .pb-subcats-dialog-header h2 {
        margin-top: 5px;
        font-size: 25px;
    }

    .pb-subcats-dialog-body {
        padding: 0 18px max(24px, env(safe-area-inset-bottom));
    }

    .pb-subcats-list a {
        min-height: 82px;
        gap: 14px;
    }

    .pb-subcats-list .pb-subcats-img {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 370px) {
    .pb-subcats-grid {
        --pb-gap: 4px;
    }

    .pb-subcats-tile,
    .pb-subcats-tile:nth-child(n+9) {
        padding: 8px 2px;
        min-height: 137px;
    }

    .pb-subcats-tile .pb-subcats-img {
        width: 51px;
        height: 51px;
    }

    .pb-subcats-name {
        font-size: 12px;
    }

    .pb-subcats.has-more-mobile .pb-subcats-all {
        font-size: 16px;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pb-subcats-dialog[open],
    .pb-subcats-dialog[open]::backdrop {
        animation: none !important;
    }
}
