/* The filter shell is shared so all catalog routes use the same desktop spacing. */
.filter-panel {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    padding: 1rem 0;
}

/* Every desktop filter group uses the same label-and-options layout. */
.filter-row {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
    align-items: start;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-row h2 {
    font-size: 1.05rem;
    color: #eef3ff;
    font-weight: 700;
    padding-top: 0.2rem;
}

.chip-list {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.34rem 0.75rem;
    background: transparent;
    color: #d5d9e2;
    font-size: 1.02rem;
    line-height: 1.2;
    white-space: nowrap;
}

.chip.active {
    color: #0a0c12;
    background: #fff;
    font-weight: 600;
}

.chip:hover,
.chip:focus-visible {
    color: #eef4ff;
    border-color: rgba(255, 255, 255, 0.2);
    outline: none;
}

/* Shared filter controls used by film, TV-series, and animation catalogs. */
.mobile-filter-layout {
    display: none;
}

/* Keep the three quick controls and expand affordance inside one viewport row. */
.mobile-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.55rem;
}

.mobile-filter-pill {
    appearance: none;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #eef3ff;
    border-radius: 999px;
    padding: 0.56rem 2rem 0.56rem 0.82rem;
    font-size: 0.94rem;
    line-height: 1.2;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="%23ffffff" d="M3.2 5.4 8 10.2l4.8-4.8"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.62rem center;
    background-size: 14px;
}

.mobile-filter-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 10px;
    color: #f4f8ff;
}

.mobile-filter-icon svg {
    width: 20px;
    height: 20px;
}

/* The expanded panel intentionally follows the static page's full-screen sheet. */
.mobile-more-filters {
    display: none;
}

.mobile-more-filters[aria-hidden='false'] {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 260;
    background: radial-gradient(circle at 15% 0%, rgba(28, 34, 50, 0.96), rgba(6, 8, 14, 0.98));
    padding: 1.2rem 1rem 1rem;
    overflow-y: auto;
}

.mobile-more-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.mobile-more-head h3 {
    font-size: 1.55rem;
    line-height: 1.2;
    color: #f4f8ff;
}

.mobile-close-filters {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    background: rgba(255, 255, 255, 0.06);
    color: #f4f8ff;
    font-size: 1.55rem;
    line-height: 1;
    cursor: pointer;
}

.mobile-more-section {
    margin-bottom: 1.2rem;
}

.mobile-more-section h4 {
    font-size: 1.03rem;
    margin-bottom: 0.62rem;
    color: #f0f5ff;
}

.mobile-pill-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.mobile-option {
    border-radius: 999px;
    border: 1px solid rgba(164, 176, 198, 0.55);
    background: rgba(255, 255, 255, 0.03);
    color: #f4f8ff;
    font-size: 0.98rem;
    padding: 0.6rem 0.7rem;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
}

.mobile-option.is-active {
    border-color: rgba(72, 238, 190, 0.9);
    background: linear-gradient(90deg, rgba(14, 184, 255, 0.18), rgba(36, 255, 130, 0.22));
    color: #f9feff;
    font-weight: 700;
}

/* The score slider keeps its legacy static-page appearance and 0–10 range. */
.mobile-rating-wrap {
    margin-top: 0.2rem;
}

.mobile-rating-wrap input[type='range'] {
    width: 100%;
    accent-color: #2ef3a7;
}

.mobile-rating-labels {
    display: flex;
    justify-content: space-between;
    color: #ecf3ff;
    font-size: 0.95rem;
    margin-top: 0.2rem;
}

.mobile-more-actions {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 2.2fr;
    gap: 0.5rem;
    padding: 0.65rem 0 0.25rem;
    background: linear-gradient(180deg, rgba(8, 10, 16, 0), rgba(8, 10, 16, 0.92) 32%);
}

.mobile-more-reset,
.mobile-more-confirm {
    border-radius: 10px;
    border: 1px solid rgba(164, 176, 198, 0.42);
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 42px;
}

.mobile-more-reset {
    background: #2c313c;
    color: #f2f6ff;
}

.mobile-more-confirm {
    border-color: rgba(72, 238, 190, 0.72);
    background: linear-gradient(90deg, #08c9ff, #37ff8f);
    color: #0a121b;
}

@media (max-width: 760px) {
    .mobile-filter-layout {
        display: grid;
        min-width: 0;
        gap: 0.55rem;
    }

    /* Let each select shrink inside the viewport instead of using its option text width. */
    .mobile-filter-row {
        grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
        min-width: 0;
    }

    .mobile-filter-pill {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        width: 100%;
    }

    .mobile-filter-icon {
        flex: 0 0 36px;
    }

    .film-page .filter-panel,
    .series-page .filter-panel {
        border-top: none;
        border-bottom: none;
        padding: 0;
        margin-top: 0.9rem;
    }

    .film-page .filter-panel {
        margin-top: 0;
    }

    .filter-panel .filter-row {
        display: none;
    }

    .chip {
        font-size: 0.95rem;
    }

    .mobile-more-filters {
        display: none;
    }

    /* Keep long filter labels and the score control within the sheet width. */
    .mobile-more-filters[aria-hidden='false'] {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .mobile-option,
    .mobile-rating-wrap,
    .mobile-rating-wrap input[type='range'] {
        min-width: 0;
        max-width: 100%;
    }

    .mobile-option {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Reduce control spacing once three selects and the filter icon become very narrow. */
@media (max-width: 380px) {
    .mobile-filter-row {
        gap: 0.35rem;
        grid-template-columns: repeat(3, minmax(0, 1fr)) 34px;
    }

    .mobile-filter-pill {
        background-position: right 0.42rem center;
        background-size: 12px;
        font-size: 0.8rem;
        padding-inline: 0.55rem 1.35rem;
    }

    .mobile-filter-icon {
        flex-basis: 34px;
        height: 34px;
        width: 34px;
    }
}
