.twl-v3-explore .story-filter-main > .filter-story-left,
.twl-v3-explore .story-filter-main > .filter-story-right,
.twl-v3-explore .ebook-filter-section > .filter-left,
.twl-v3-explore .ebook-filter-section > .filter-right {
    height: 63px;
    position: relative;
}

.twl-v3-explore .story-filter-main > .filter-story-left > label,
.twl-v3-explore .story-filter-main > .filter-story-right > label,
.twl-v3-explore .ebook-filter-section > .filter-left > label,
.twl-v3-explore .ebook-filter-section > .filter-right > label {
    display: block;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-md);
    font-weight: 500;
    height: 19px;
    line-height: 19px;
    margin: 0 0 4px;
}

.twl-v3-explore .search-category-trigger {
    box-sizing: border-box;
    height: 40px !important;
}

.search-smooth-filter {
    height: 40px;
    position: relative;
    width: 150px;
}

.search-smooth-filter__native {
    height: 1px !important;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 1px !important;
}

.search-smooth-filter__trigger {
    align-items: center;
    background: var(--Base-bg-base);
    border: 1px solid var(--Border-Neutral-default);
    border-radius: 8px;
    color: var(--Text-Neutral-primary);
    display: flex;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-lg);
    font-weight: 500;
    gap: 8px;
    height: 40px;
    padding: 8px 16px;
    text-align: left;
    width: 100%;
}

.search-smooth-filter__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-smooth-filter__trigger > i {
    flex: 0 0 20px;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-smooth-filter__trigger[aria-expanded="true"] > i {
    transform: rotate(180deg);
}

.search-smooth-filter__menu {
    background: var(--Base-bg-raised);
    border: 1px solid var(--Border-Neutral-subtle);
    border-radius: 8px;
    box-shadow: var(--Elevation-md);
    left: 0;
    min-width: 100%;
    overflow: hidden;
    padding: 4px;
    position: absolute;
    top: calc(100% + 4px);
    transform-origin: top left;
    z-index: 1060;
}

.search-smooth-filter__menu[hidden] {
    display: none;
}

.search-smooth-filter__option {
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--Text-Neutral-primary);
    display: block;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-lg);
    font-weight: 500;
    min-height: 36px;
    padding: 6px 12px;
    text-align: left;
    width: 100%;
}

.search-smooth-filter__option:hover,
.search-smooth-filter__option:focus-visible,
.search-smooth-filter__option.is-selected {
    background: var(--Background-Brand-subtle);
    color: var(--Text-Brand-default);
}

.search-smooth-filter__option:disabled {
    background: transparent;
    color: var(--Text-Neutral-disabled);
    cursor: not-allowed;
}

.search-category-trigger {
    align-items: center;
    background: var(--Base-bg-base);
    border: 1px solid var(--Border-Neutral-subtle);
    border-radius: 8px;
    color: var(--Text-Neutral-primary);
    display: flex;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-lg);
    font-weight: 500;
    gap: 8px;
    height: 40px;
    justify-content: flex-start;
    min-width: 200px;
    padding: 8px 16px;
    text-align: left;
}

.search-category-trigger__text {
    flex: 1;
}

.search-category-trigger__count,
.search-category-house__count {
    align-items: center;
    background: var(--Background-Neutral-tertiary);
    border-radius: var(--Radius-full);
    color: var(--Text-Neutral-disabled);
    display: inline-flex;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-lg);
    font-weight: 700;
    height: 20px;
    justify-content: center;
    min-width: 24px;
    padding: 2px 8px;
}

.search-category-trigger.is-active {
    background: var(--Background-Brand-subtle);
    border-color: var(--Border-Brand-default);
}

.search-category-trigger.is-active > i {
    color: var(--Icon-Brand-default);
}

.search-category-trigger > i {
    flex: 0 0 20px;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-category-trigger[aria-expanded="true"] > i {
    transform: rotate(180deg);
}

.search-category-trigger__count,
.search-category-house__count.is-selected {
    background: var(--Background-Brand-default);
    color: var(--Base-on-color);
}

.search-category-dropdown {
    background: var(--Base-bg-raised);
    border: 1px solid var(--Base-border-raised);
    border-radius: 24px;
    box-sizing: border-box;
    box-shadow: var(--Elevation-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
    left: 0;
    position: absolute;
    padding: 24px;
    top: calc(100% + 4px);
    transform-origin: top left;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    width: min(600px, calc(100vw - 32px));
    z-index: 1050;
}

.search-category-dropdown[hidden] {
    display: none;
}

.search-category-dropdown__body {
    display: flex;
    flex: 1 1 312px;
    gap: 24px;
    min-height: 0;
    overflow-y: auto;
}

.search-category-houses {
    flex: 0 0 140px;
}

.search-category-houses h3,
.search-category-options h3 {
    color: var(--Text-Neutral-primary);
    font-family: var(--Heading-font-family);
    font-size: var(--Heading-font-size-sm);
    font-weight: 500;
    margin: 0 0 12px;
}

.search-category-houses__list {
    display: flex;
    flex-direction: column;
}

.search-category-house {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    display: flex;
    height: 56px;
    justify-content: space-between;
    padding: 4px 12px;
    width: 140px;
}

.search-category-house.is-active,
.search-category-house.is-selected {
    background: var(--Background-Brand-subtle);
}

.search-category-house img {
    height: 48px;
    object-fit: contain;
    width: 48px;
}

.search-category-options {
    flex: 1;
    min-width: 0;
}

.search-category-options__head {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.search-category-options__toggle {
    background: transparent;
    border: 0;
    color: var(--Text-Brand-default);
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-lg);
    font-weight: 500;
    padding: 0;
}

.search-category-options__grid {
    display: grid;
    gap: 12px;
    grid-auto-flow: column;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(8, 24px);
}

.search-category-option--all {
    grid-column: 1;
    grid-row: 1;
}

.search-category-option__spacer {
    grid-column: 2;
    grid-row: 1;
}

.search-category-option {
    align-items: center;
    color: var(--Text-Neutral-primary);
    cursor: pointer;
    display: flex;
    font-family: var(--Body-font-family);
    font-size: var(--Body-font-size-md);
    font-weight: 500;
    line-height: var(--Body-font-line-height-md);
    gap: 8px;
    height: 24px;
    margin: 0;
    min-width: 0;
}

.search-category-option input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.search-category-option__box {
    align-items: center;
    background: var(--Base-bg-base);
    border: 1px solid var(--Border-Brand-default);
    border-radius: 4px;
    display: inline-flex;
    flex: 0 0 20px;
    height: 20px;
    justify-content: center;
}

.search-category-option input:checked + .search-category-option__box {
    background: var(--Background-Brand-default);
}

.search-category-option input:checked + .search-category-option__box::after {
    border: solid var(--Base-on-color);
    border-width: 0 2px 2px 0;
    content: "";
    height: 10px;
    transform: rotate(45deg) translate(-1px, -1px);
    width: 6px;
}

.search-category-option input:focus-visible + .search-category-option__box {
    box-shadow: 0 0 0 3px var(--Background-Brand-subtle-active);
}

.search-category-option img {
    flex: 0 0 20px;
    height: 20px;
    object-fit: contain;
    width: 20px;
}

.search-category-option__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-category-dropdown__footer {
    display: flex;
    flex: 0 0 auto;
    gap: 12px;
}

.search-category-dropdown__cancel,
.search-category-dropdown__apply {
    align-items: center;
    border-radius: var(--Radius-full);
    display: flex;
    flex: 1;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-lg);
    font-weight: 700;
    height: 44px;
    justify-content: center;
    padding: 10px 24px;
    text-align: center;
}

.search-category-dropdown__cancel {
    background: var(--Base-bg-base);
    border: 1px solid var(--Border-Brand-default);
    color: var(--Text-Brand-default);
}

.search-category-dropdown__apply {
    background: var(--Background-Brand-default);
    border: 1px solid var(--Background-Brand-default);
    color: var(--Base-on-color);
}

.search-category-backdrop {
    background: var(--Background-Static-black-overlay, rgba(0, 0, 0, 0.5));
    bottom: 0;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000000;
}

.search-category-backdrop[hidden] {
    display: none;
}

@media (min-width: 768px) {
    .search-category-backdrop {
        display: none !important;
    }
}

.search-category-dropdown__header {
    display: none;
}

.search-category-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.search-category-mobile-item {
    border-bottom: 0;
    padding-bottom: 0;
}

.search-category-mobile-row {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    width: 100%;
}

.search-category-mobile-house {
    align-items: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: flex;
    flex: 1;
    gap: 12px;
    justify-content: space-between;
    min-height: 56px;
    padding: 8px 0;
    text-align: left;
}

.search-category-mobile-checkbox {
    align-items: center;
    background: var(--Base-bg-base);
    border: 1px solid var(--Border-Brand-default);
    border-radius: 4px;
    color: var(--Base-on-color);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 20px;
    height: 20px;
    justify-content: center;
    padding: 0;
    width: 20px;
}

.search-category-mobile-checkbox.is-active {
    background: var(--Background-Brand-default);
    border-color: var(--Border-Brand-default);
}

.search-category-mobile-house__img {
    flex: 0 0 58px;
    height: 32px;
    object-fit: contain;
    width: 58px;
}

.search-category-mobile-house__brand,
.search-category-mobile-house__actions {
    align-items: center;
    display: flex;
}

.search-category-mobile-house__brand {
    gap: 8px;
    min-width: 0;
}

.search-category-mobile-house__actions {
    flex: 0 0 auto;
    gap: 12px;
}

.search-category-mobile-house__name {
    border-radius: var(--Radius-full);
    color: var(--Base-on-color);
    flex: 0 0 auto;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-lg);
    font-weight: 700;
    line-height: 24px;
    padding: 0 8px;
    white-space: nowrap;
}

.search-category-mobile-house__name--hetero {
    background: var(--TUN-Hetero-text, #ff775f);
}

.search-category-mobile-house__name--boy-love {
    background: var(--TUN-BL-text, #a078fd);
}

.search-category-mobile-house__name--girl-love {
    background: var(--TUN-GL-text, #ff3d91);
}

.search-category-mobile-house__name--fanfic {
    background: var(--TUN-Fanfic-text, #22bcf2);
}

.search-category-mobile-house__badge {
    align-items: center;
    background: var(--Background-Neutral-tertiary);
    border-radius: var(--Radius-full);
    color: var(--Text-Neutral-disabled);
    display: inline-flex;
    flex: 0 0 auto;
    font-family: var(--Action-font-family);
    font-size: var(--Action-font-size-md, 14px);
    font-weight: 700;
    height: 20px;
    justify-content: center;
    min-width: 24px;
    padding: 2px 8px;
}

.search-category-mobile-house__badge.is-selected {
    background: var(--Background-Brand-default);
    color: var(--Base-on-color);
}

.search-category-mobile-house__chevron {
    color: var(--Icon-Neutral-secondary, #666);
    flex: 0 0 20px;
    font-size: 20px;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-category-mobile-house[aria-expanded="true"] .search-category-mobile-house__chevron {
    transform: rotate(180deg);
}

.search-category-mobile-panel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.search-category-mobile-panel.is-expanded {
    grid-template-rows: 1fr;
    opacity: 1;
}

.search-category-mobile-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    overflow: hidden;
    padding: 8px 0 12px;
}

.search-category-mobile-tile {
    align-items: center;
    background: var(--Base-bg-base);
    border: 1px solid var(--Border-Neutral-subtle);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 8px;
    height: 52px;
    min-height: 52px;
    padding: 6px 10px;
    text-align: left;
    width: 100%;
}

.search-category-mobile-tile.is-selected {
    background: var(--Background-Brand-subtle);
    border-color: var(--Border-Brand-default);
}

.search-category-mobile-tile img {
    flex: 0 0 40px;
    height: 40px;
    object-fit: contain;
    width: 40px;
}

.search-category-mobile-tile__title {
    color: var(--Text-Neutral-primary);
    flex: 1;
    font-family: var(--Body-font-family);
    font-size: var(--Body-font-size-md, 15px);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .search-category-trigger {
        min-width: 150px;
        width: 100%;
    }

    .search-category-dropdown {
        border: 0;
        border-radius: 24px 24px 0 0;
        bottom: 0;
        box-shadow: var(--Elevation-lg, 0 -4px 20px rgba(0, 0, 0, 0.15));
        gap: 12px;
        left: 0;
        max-height: calc(100dvh - 16px);
        max-width: 100vw;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        position: fixed;
        right: 0;
        top: auto;
        width: 100vw;
        z-index: 1000001;
    }

    .search-category-dropdown.is-mobile-expanded {
        max-height: calc(100dvh - 16px);
    }

    .search-category-dropdown__header {
        align-items: center;
        border-bottom: 0;
        display: flex;
        flex: 0 0 auto;
        justify-content: space-between;
        padding-bottom: 8px;
    }

    .search-category-dropdown__title {
        color: var(--Text-Neutral-primary);
        font-family: var(--Heading-font-family);
        font-size: 24px;
        font-weight: 700;
        margin: 0;
    }

    .search-category-dropdown__close {
        align-items: center;
        background: transparent;
        border: 0;
        border-radius: 50%;
        color: var(--Text-Neutral-secondary, #666);
        cursor: pointer;
        display: inline-flex;
        height: 36px;
        justify-content: center;
        padding: 0;
        width: 36px;
    }

    .search-category-dropdown__close:hover,
    .search-category-dropdown__close:focus-visible {
        background: var(--Background-Neutral-subtle, #f5f5f5);
        color: var(--Text-Neutral-primary);
    }

    .search-category-dropdown__body--desktop {
        display: none !important;
    }

    .search-category-dropdown__body--mobile {
        display: block;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .search-category-dropdown__footer {
        flex: 0 0 auto;
        padding-top: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-category-mobile-panel,
    .search-category-mobile-house__chevron {
        transition: none;
    }
}
