.tomi-hot-categories-wrap {
    --tomi-gap: 12px;
    --tomi-radius: 20px;
    --tomi-title-color: #0f172a;
    --tomi-text-light: rgba(255,255,255,.96);
    --tomi-text-soft: rgba(255,255,255,.82);
    --tomi-overlay: linear-gradient(180deg, rgba(3,7,18,0.08) 0%, rgba(3,7,18,0.24) 52%, rgba(3,7,18,0.82) 100%);
    --tomi-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
    --tomi-shadow-hover: 0 18px 38px rgba(15, 23, 42, 0.16);
    --tomi-border: rgba(255,255,255,.26);
    --tomi-card-bg: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);

    position: relative;
    width: 100%;
    margin: 0;
}

.tomi-hot-categories-wrap,
.tomi-hot-categories-wrap * {
    box-sizing: border-box;
}

.tomi-hot-categories-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.tomi-hot-categories-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--tomi-title-color);
}

.tomi-hot-categories-subtitle {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

/* ✅ 改用 CSS Custom Properties，預設值與舊版一致（8 / 4 / 4） */
.tomi-hot-categories-grid {
    display: grid;
    grid-template-columns: repeat(var(--tomi-cols, 8), minmax(0, 1fr));
    gap: var(--tomi-gap);
    width: 100%;
}

.tomi-hot-category-card {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    aspect-ratio: 1 / 1;
    min-height: auto;
    border-radius: var(--tomi-radius);
    background: var(--tomi-card-bg);
    text-decoration: none;
    box-shadow: var(--tomi-shadow);
    isolation: isolate;
    transform: translateZ(0);
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease, filter .28s ease;
    border: 1px solid rgba(203, 213, 225, .8);
    -webkit-tap-highlight-color: transparent;
}

.tomi-hot-category-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px var(--tomi-border);
    opacity: .6;
}

.tomi-hot-category-card:hover,
.tomi-hot-category-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--tomi-shadow-hover);
    border-color: rgba(59, 130, 246, .28);
}

.tomi-hot-category-card.is-featured {
    box-shadow: 0 14px 34px rgba(37, 99, 235, .20);
    border-color: rgba(37, 99, 235, .24);
}

.tomi-hot-category-card.is-featured::before {
    content: "";
    position: absolute;
    inset: auto -10% -22% -10%;
    height: 46%;
    background: radial-gradient(circle, rgba(59,130,246,.20) 0%, rgba(59,130,246,0) 72%);
    z-index: 0;
    pointer-events: none;
}

.tomi-hot-category-media {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.tomi-hot-category-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1);
    transition: transform .55s ease;
}

.tomi-hot-category-card:hover .tomi-hot-category-media img,
.tomi-hot-category-card:focus-visible .tomi-hot-category-media img {
    transform: scale(1.05);
}

.tomi-hot-category-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,0) 20%),
        var(--tomi-overlay);
    pointer-events: none;
}

.tomi-hot-category-content {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: auto;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

.tomi-hot-category-kicker {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 7px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    backdrop-filter: blur(8px);
    color: rgba(255,255,255,.96);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .03em;
    line-height: 1;
}

.tomi-hot-category-name {
    display: -webkit-box;
    width: 100%;
    overflow: hidden;
    color: var(--tomi-text-light);
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
    word-break: break-word;
    text-shadow: 0 2px 14px rgba(0,0,0,.26);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tomi-hot-category-card:focus-visible {
    outline: 0;
}

.tomi-hot-category-card:focus-visible::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: calc(var(--tomi-radius) - 3px);
    border: 2px solid rgba(255,255,255,.75);
    z-index: 3;
    pointer-events: none;
}

.elementor .tomi-hot-categories-wrap,
.elementor-editor-active .tomi-hot-categories-wrap,
body.elementor-editor-active .tomi-hot-categories-wrap {
    width: 100%;
}

.elementor .tomi-hot-categories-wrap .tomi-hot-categories-grid,
.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-categories-grid,
body.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-categories-grid {
    display: grid !important;
    width: 100% !important;
}

.elementor .tomi-hot-categories-wrap .tomi-hot-category-card,
.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-category-card,
body.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-category-card {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

.elementor .tomi-hot-categories-wrap .tomi-hot-category-media,
.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-category-media,
body.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-category-media {
    position: absolute !important;
    inset: 0 !important;
}

.elementor .tomi-hot-categories-wrap .tomi-hot-category-content,
.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-category-content,
body.elementor-editor-active .tomi-hot-categories-wrap .tomi-hot-category-content {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 1200px) {
    .tomi-hot-categories-title {
        font-size: 20px;
    }

    .tomi-hot-category-name {
        font-size: 17px;
    }
}

@media (max-width: 1024px) {
    /* ✅ 改用 CSS Custom Properties */
    .tomi-hot-categories-grid {
        grid-template-columns: repeat(var(--tomi-cols-tablet, 4), minmax(0, 1fr));
    }

    .tomi-hot-category-name {
        font-size: 16px;
    }

    .tomi-hot-category-content {
        padding: 10px;
    }
}

@media (max-width: 767px) {
    .tomi-hot-categories-head {
        margin-bottom: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    .tomi-hot-categories-title {
        font-size: 18px;
    }

    /* ✅ 改用 CSS Custom Properties */
    .tomi-hot-categories-grid {
        grid-template-columns: repeat(var(--tomi-cols-mobile, 4), minmax(0, 1fr));
        gap: 8px;
    }

    .tomi-hot-category-card {
        border-radius: 14px;
    }

    .tomi-hot-category-content {
        padding: 8px;
    }

    .tomi-hot-category-kicker {
        display: none;
    }

    .tomi-hot-category-name {
        font-size: 13px;
        line-height: 1.15;
        letter-spacing: -0.01em;
    }
}