:root {
    --home-brand: #6f42c1;
    --home-brand-dark: #4c2a91;
    --home-surface: #ffffff;
    --home-surface-muted: #f7f5fc;
    --home-text: #24212b;
    --home-muted: #625e6b;
    --home-border: rgba(61, 39, 94, 0.13);
    --home-shadow: 0 14px 38px rgba(54, 32, 86, 0.13);
}

.home-hero {
    overflow: visible;
}

.home-hero__title {
    font-size: 2.8rem;
    font-weight: 400;
}

.home-hero__value {
    color: var(--home-muted);
    font-size: 0.95rem;
    margin: 0 auto;
    max-width: 42rem;
}

.home-hero-actions {
    display: flex;
    flex-direction: column;
}

.home-category-nav {
    order: 1;
}

.home-search-wrap {
    order: 2;
}

.cat-nav-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 10px;
}

.cat-item {
    position: relative;
}

.cat-link {
    align-items: center;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 30px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    color: #555;
    cursor: pointer;
    display: inline-flex;
    font-weight: 500;
    min-height: 44px;
    padding: 8px 18px;
    position: relative;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    z-index: 2;
}

.cat-item:nth-child(5n + 1) .cat-link {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #bbdefb;
    color: #0d47a1;
}

.cat-item:nth-child(5n + 2) .cat-link {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #e1bee7;
    color: #4a148c;
}

.cat-item:nth-child(5n + 3) .cat-link {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
    border-color: #b2dfdb;
    color: #004d40;
}

.cat-item:nth-child(5n + 4) .cat-link {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #ffe0b2;
    color: #b83f00;
}

.cat-item:nth-child(5n + 5) .cat-link {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
    border-color: #f8bbd0;
    color: #7c0c47;
}

.cat-link:hover,
.cat-link:focus-visible,
.cat-item:focus-within .cat-link,
.cat-item.is-open .cat-link {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    filter: brightness(0.98);
    transform: translateY(-2px);
}

.cat-popup {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: none;
    left: 50%;
    margin-top: 12px;
    max-width: 600px;
    min-width: 320px;
    padding: 12px 15px;
    position: absolute;
    text-align: left;
    top: 100%;
    transform: translateX(-50%);
    width: max-content;
    z-index: 1040;
}

.cat-popup::after {
    background: transparent;
    content: "";
    height: 15px;
    left: 0;
    position: absolute;
    top: -15px;
    width: 100%;
}

.cat-popup::before {
    border-color: #fff transparent;
    border-style: solid;
    border-width: 0 6px 6px;
    content: "";
    left: 50%;
    margin-left: -6px;
    position: absolute;
    top: -6px;
}

.cat-item:hover .cat-popup,
.cat-item:focus-within .cat-popup,
.cat-item.is-open .cat-popup {
    animation: category-popup-in 0.18s ease-out;
    display: block;
}

.cat-popup__heading {
    color: var(--home-text);
    font-size: 1rem;
    font-weight: 700;
}

.cat-popup__close {
    align-items: center;
    background: var(--home-surface-muted);
    border: 0;
    border-radius: 50%;
    color: var(--home-text);
    display: none;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.sub-cat-link {
    background: #f1f3f5;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #454a50;
    display: inline-flex;
    margin: 4px;
    min-height: 44px;
    padding: 10px 12px;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sub-cat-link:hover,
.sub-cat-link:focus-visible {
    background: #e9ecef;
    border-color: #cfd4da;
    color: #212529;
}

.category-scrim {
    display: none;
}

.home-tool-action {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: #5f5a68;
    display: inline-flex;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 8px;
}

.home-tool-action:hover,
.home-tool-action:focus-visible {
    background: #f0ebfa;
    color: var(--home-brand-dark);
}

.home-load-more[data-server-next="false"] {
    display: none;
}

.home-load-more[hidden] {
    display: none !important;
}

@keyframes category-popup-in {
    from {
        opacity: 0;
        transform: translate(-50%, 8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (max-width: 767.98px) {
    .home-hero {
        background: linear-gradient(180deg, #f4effd 0%, #fbfaff 100%);
    }

    .home-hero__title {
        font-size: clamp(1.65rem, 7vw, 2.05rem);
        font-weight: 650;
        letter-spacing: -0.035em;
        line-height: 1.14;
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 1.55rem !important;
    }

    .home-hero-actions {
        padding-bottom: 1rem !important;
        padding-top: 0.9rem !important;
    }

    .home-search-wrap {
        order: 1;
        padding: 0.3rem 0.75rem 0.75rem !important;
        width: 100%;
    }

    .home-search-wrap .form-control {
        min-height: 48px;
    }

    .home-search-wrap .go-search {
        min-height: 44px;
        min-width: 44px;
    }

    .home-category-nav {
        order: 2;
        overflow: hidden;
        width: 100%;
    }

    .cat-nav-container {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 6px 12px 12px;
        scrollbar-width: none;
        scroll-padding-inline: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .cat-nav-container::-webkit-scrollbar {
        display: none;
    }

    .cat-item {
        flex: 0 0 auto;
        position: static;
    }

    .cat-link {
        white-space: nowrap;
    }

    .cat-item:hover .cat-popup,
    .cat-item:focus-within .cat-popup {
        display: none;
    }

    .cat-item.is-open .cat-popup {
        animation: category-sheet-in 0.22s ease-out;
        border-radius: 22px 22px 0 0;
        bottom: 0;
        box-shadow: 0 -10px 34px rgba(36, 24, 52, 0.18);
        display: block;
        left: 0;
        margin: 0;
        max-height: min(72vh, 620px);
        max-width: none;
        min-width: 0;
        overflow-y: auto;
        padding: 12px 16px calc(22px + env(safe-area-inset-bottom));
        position: fixed;
        right: 0;
        top: auto;
        transform: none;
        width: 100%;
        z-index: 1065;
    }

    .cat-popup::before,
    .cat-popup::after {
        display: none;
    }

    .cat-popup__close {
        display: inline-flex;
    }

    .category-scrim.is-visible {
        background: rgba(25, 18, 34, 0.46);
        display: block;
        inset: 0;
        position: fixed;
        z-index: 1060;
    }

    body.category-sheet-open {
        overflow: hidden;
    }

    .home-main {
        border-right: 0 !important;
        order: 0 !important;
    }

    .home-sidebar {
        contain-intrinsic-size: 900px;
        content-visibility: auto;
        order: 1 !important;
        padding-top: 1.75rem;
    }

    .home-tools-grid .ailist[data-mobile-deferred="true"] {
        display: none;
    }

    .home-tools-grid.show-mobile-deferred .ailist[data-mobile-deferred="true"] {
        display: block;
    }

    .home-load-more[data-has-mobile-deferred="true"] {
        display: block;
    }

    .home-tools-grid .card {
        border: 1px solid var(--home-border) !important;
        box-shadow: 0 8px 24px rgba(54, 32, 86, 0.08) !important;
    }

    .home-tool-action {
        min-height: 44px;
        min-width: 44px;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .home-tools-grid > .col {
        flex: 0 0 auto;
        width: 50%;
    }
}

@keyframes category-sheet-in {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cat-link,
    .cat-popup,
    .sub-cat-link {
        animation: none !important;
        scroll-behavior: auto;
        transition: none !important;
    }
}
