.category-section {
    width: 100%;
    /* padding: 40px 0; */
}

.category-title {
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 20px;
    margin: 10px;
    color: #444;
}

.category-carousel-container {
    max-width: 1190px;
    margin: 0 auto;
    /* padding: 0 20px; */
    position: relative;
    display: flex;
    justify-content: center;
}

.category-carousel-wrapper {
    overflow-y: hidden;
    scroll-behavior: smooth;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    width: fit-content;
    max-width: 100%;

    display: flex;
    white-space: nowrap;
    -ms-overflow-style: none;
    scrollbar-width: 10;
    font-size: 0;
}

/* .category-carousel-wrapper::-webkit-scrollbar {
height: 9px;
} */

.category-carousel-wrapper::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.category-carousel-wrapper::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(6, 200px);
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: row;
    /* Fill row 1 first, then row 2 */
    gap: 15px;
    padding: 10px;
    width: fit-content;
}

/* Dynamic grid adjustment */
.category-grid.centered {
    margin: 0 auto;
}

.category-card {
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    /* transition: transform 0.3s; */
    cursor: pointer;
    position: relative;
    touch-action: manipulation;
}


.category-card a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.category-image-wrapper {
    width: 100%;
    height: 145px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.category-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 55px;
    position: relative;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.category-label {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-top: 8px;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .category-section {
        padding: 15px 0;
    }

    .category-title {
        font-size: 16px;
        margin-bottom: 15px;
        font-weight: bold;
    }

    .category-carousel-container {
        padding: 0 5px;
        overflow: hidden;
    }

    .category-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, calc((100vw - 30px) / 2.5));
        grid-template-rows: auto;
        grid-auto-flow: row;
        gap: 15px;
        padding: 0;
        width: fit-content;
        max-width: none;
    }

    .category-carousel-wrapper {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding-bottom: 15px;
    }

    .category-card {
        width: 100%;
        touch-action: manipulation;
        scroll-snap-align: start;
    }

    .category-image-wrapper {
        height: calc((100vw - 30px) / 2.5);
        border-radius: 12px;
        overflow: hidden;
    }

    .category-image {
        height: 100%;
        font-size: 42px;
    }

    .category-label {
        text-align: center;
        font-size: 12px;
        font-weight: 500;
        color: #333;
        margin-top: 6px;
        line-height: 1.3;
    }

    .category-image img {
        max-height: 107px;
    }
}

@media (max-width: 480px) {
    .category-title {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .category-carousel-container {
        padding: 0 5px;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, calc((100vw - 24px) / 2.5));
        gap: 15px;
        width: fit-content;
    }

    .category-image-wrapper {
        height: calc((100vw - 24px) / 2.5);
        border-radius: 10px;
    }

    .category-image {
        height: 100%;
        font-size: 36px;
    }

    .category-label {
        font-size: 11px;
        margin-top: 5px;
    }

    .category-image img {
        max-height: 107px;
    }
}