.ec-categoryRole {
    background: var(--soft-gray, #F0EDE5);
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 5rem 0;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
}

.ec-categoryRole .ec-role {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
    width: 100%;
}

/* カテゴリリストのスタイル - PC版グリッドレイアウト */
.ec-categoryRole__list {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: repeat(2, auto) !important;
    gap: 2.5rem !important;
    justify-items: center !important;
    align-items: start !important;
    justify-content: center !important;
    margin-top: 3rem !important;
    width: 100% !important;
    max-width: 1000px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
}

/* PC版：5つのカテゴリを2行レイアウト */
.ec-categoryRole__listItem {
    width: 100%;
    max-width: 320px;
    min-width: 280px;
    text-align: center;
    box-sizing: border-box;
}

.ec-categoryRole__listItem a {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.ec-categoryRole__listItem a:hover {
    transform: translateY(-8px);
    text-decoration: none;
}

/* カテゴリ画像のスタイル */
.ec-categoryRole__listItem img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(139, 115, 85, 0.15);
    transition: all 0.3s ease;
}

.ec-categoryRole__listItem a:hover img {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(139, 115, 85, 0.25);
}

/* カテゴリ名のスタイル */
.category-name {
    margin-top: 1.5rem;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--earth-brown, #8B6F47);
    text-align: center;
    font-family: "FOT-筑紫A丸ゴシック Std M", TsukuARdGothicStd-M, "ヒラギノ丸ゴ ProN W4", "Hiragino Maru Gothic ProN", メイリオ, Meiryo, sans-serif !important;
    letter-spacing: 0.02em;
}

/* PC版：5つのアイテムの具体的な配置 */
.ec-categoryRole__listItem:nth-child(1) { grid-column: 1 !important; grid-row: 1 !important; } /* 米 */
.ec-categoryRole__listItem:nth-child(2) { grid-column: 2 !important; grid-row: 1 !important; } /* 小麦 */
.ec-categoryRole__listItem:nth-child(3) { grid-column: 3 !important; grid-row: 1 !important; } /* もち麦 */
.ec-categoryRole__listItem:nth-child(4) { grid-column: 1 !important; grid-row: 2 !important; } /* 平飼い卵 */
.ec-categoryRole__listItem:nth-child(5) { grid-column: 2 !important; grid-row: 2 !important; } /* 米米バッグ */

/* デスクトップ専用（1025px以上）でも確実に2行レイアウト適用 */
@media (min-width: 1025px) {
    .ec-categoryRole__list {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, auto) !important;
        gap: 3rem !important;
        justify-items: center !important;
        align-items: start !important;
        max-width: 1100px !important;
        margin: 3rem auto 0 !important;
    }
    
    .ec-categoryRole__listItem {
        width: 100% !important;
        max-width: 350px !important;
        min-width: 300px !important;
    }
    
    .ec-categoryRole__listItem img {
        height: 220px !important;
    }
    
    .category-name {
        font-size: 1.4rem !important;
        margin-top: 1.5rem !important;
    }
}

/* レスポンシブ対応 */
/* タブレット表示（768px-991px）- 5アイテム対応 */
@media (min-width: 768px) and (max-width: 991px) {
    .ec-categoryRole .ec-role {
        padding: 0 1.5rem;
    }
    
    .ec-categoryRole__list {
        gap: 1.5rem;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        max-width: 100%;
        justify-items: center;
        margin: 0 auto;
        padding: 0 10px;
    }
    
    .ec-categoryRole__listItem {
        width: 100%;
        max-width: 200px;
        min-width: 160px;
        flex: none;
    }
    
    .ec-categoryRole__listItem img {
        height: 160px;
        width: 100%;
    }
    
    .category-name {
        font-size: 1.1rem;
        margin-top: 1rem;
    }
}

/* 全タブレットサイズのカテゴリ調整 - 5列対応（1行目3つ、2行目2つ） */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .ec-categoryRole {
        width: 100% !important;
        overflow-x: hidden !important;
        padding: 3rem 0 !important;
    }
    
    .ec-categoryRole .ec-role {
        padding: 0 20px !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    
    .ec-categoryRole__list {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, auto) !important;
        gap: 25px !important;
        justify-items: center !important;
        align-items: start !important;
        justify-content: center !important;
        padding: 0 30px !important;
        margin: 3rem auto 0 !important;
        max-width: 900px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }
    
    .ec-categoryRole__listItem {
        width: 100% !important;
        max-width: 260px !important;
        min-width: 220px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .ec-categoryRole__listItem img {
        height: 150px !important;
        width: 100% !important;
        object-fit: cover !important;
        border-radius: 8px !important;
    }
    
    .category-name {
        font-size: 15px !important;
        margin-top: 10px !important;
        font-weight: 500 !important;
    }
    
    /* 5つのアイテムを1行目3つ、2行目2つで配置 */
    .ec-categoryRole__listItem:nth-child(1) { grid-column: 1; grid-row: 1; } /* 米 */
    .ec-categoryRole__listItem:nth-child(2) { grid-column: 2; grid-row: 1; } /* 小麦 */
    .ec-categoryRole__listItem:nth-child(3) { grid-column: 3; grid-row: 1; } /* もち麦 */
    .ec-categoryRole__listItem:nth-child(4) { grid-column: 1; grid-row: 2; } /* 平飼い卵 */
    .ec-categoryRole__listItem:nth-child(5) { grid-column: 2; grid-row: 2; } /* 米米バッグ */
}

/* スマートフォン横向き・小さいタブレット（577px-767px） - 5列対応 */
@media (min-width: 577px) and (max-width: 767px) {
    .ec-categoryRole .ec-role {
        padding: 0 1rem;
    }
    
    .ec-categoryRole__list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, auto);
        gap: 1rem;
        justify-items: center;
    }
    
    .ec-categoryRole__listItem {
        width: 100%;
        max-width: 180px;
        min-width: 140px;
        flex: none;
    }
    
    .ec-categoryRole__listItem img {
        height: 140px;
        width: 100%;
    }
    
    .category-name {
        font-size: 1rem;
    }
    
    /* 5つのアイテムを1行目3つ、2行目2つで配置 */
    .ec-categoryRole__listItem:nth-child(1) { grid-column: 1; grid-row: 1; }
    .ec-categoryRole__listItem:nth-child(2) { grid-column: 2; grid-row: 1; }
    .ec-categoryRole__listItem:nth-child(3) { grid-column: 3; grid-row: 1; }
    .ec-categoryRole__listItem:nth-child(4) { grid-column: 1; grid-row: 2; }
    .ec-categoryRole__listItem:nth-child(5) { grid-column: 2; grid-row: 2; }
}


@media (max-width: 576px) {
    .ec-categoryRole .ec-role {
        padding: 0 1rem;
    }
    
    .ec-categoryRole__list {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
        align-items: center !important;
        justify-content: center !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
    }
    
    .ec-categoryRole__listItem {
        width: 100% !important;
        max-width: 300px !important;
        min-width: auto !important;
        grid-column: unset !important;
        grid-row: unset !important;
    }
    
    .ec-categoryRole__listItem img {
        height: 200px !important;
        width: 100% !important;
    }
    
    .category-name {
        font-size: 1.2rem !important;
        margin-top: 1rem !important;
    }
}