.qs-trigger {
    display: inline-flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    width: 160px;
    height: 40px;
    padding: 0 10px 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    appearance: none;
    background-color: var(--input-bg);
    color: var(--text-placeholder);
    font: inherit;
    font-size: 15px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.qs-trigger:hover {
    background-color: #efefef;
    color: var(--text-main);
    transition-duration: 0.12s;
}

.qs-trigger:active {
    background-color: #e8e8e8;
}

.qs-trigger:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.qs-trigger__icon {
    flex: none;
    width: 20px;
    height: 20px;
    color: var(--text-light);
    transition: color 0.2s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qs-trigger:hover .qs-trigger__icon {
    color: var(--text-main);
    transform: scale(1.05);
}

.qs-trigger:active .qs-trigger__icon {
    transform: scale(0.92);
    transition-duration: 0.1s;
}

html.dark .qs-trigger {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

html.dark .qs-trigger:hover {
    background-color: rgba(255, 255, 255, 0.065);
    border-color: rgba(255, 255, 255, 0.06);
}

html.dark .qs-trigger:active {
    background-color: rgba(255, 255, 255, 0.045);
}

.qs {
    --qs-bg: var(--bg-card);
    --qs-divider: var(--border-light);
    --qs-field-bg: var(--bg-card);
    --qs-field-ring: var(--nav-menu-border);
    --qs-poster-tint: rgba(0, 0, 0, 0.06);
    --qs-scrollbar: rgba(0, 0, 0, 0.2);
    --qs-key-bg: #fff;
    --qs-key-text: #4a4a4a;
    --qs-fill: #f2f2f2;
    --qs-muted: #6b6b6b;
    --qs-hint-bg: #f7f7f7;
    --qs-btn-bg: #141414;
    --qs-btn-text: #fff;
    --qs-hint-ring: #e1e1e1;
    width: min(560px, calc(100% - 32px));
    max-width: none;
    max-height: calc(90dvh - 16px);
    margin: 10vh auto auto;
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--qs-bg);
    color: var(--text-main);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 24px 64px rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.qs[open] {
    display: flex;
    flex-direction: column;
    animation: qs-in 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.qs::backdrop {
    background: rgba(0, 0, 0, 0.55);
    animation: qs-fade 0.15s cubic-bezier(0.2, 0, 0, 1);
}

html:has(.qs[open]) {
    overflow: hidden;
    scrollbar-gutter: stable;
}

.qs [hidden] {
    display: none;
}

.qs__form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.qs__field {
    position: relative;
    display: flex;
    align-items: center;
    flex: none;
    padding: 12px 16px;
}

.qs__icon {
    position: absolute;
    left: 30px;
    width: 20px;
    height: 20px;
    color: var(--text-main);
    pointer-events: none;
}

.qs .qs__input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding: 0 96px 0 44px;
    border: 0;
    border-radius: 10px;
    background: var(--qs-field-bg);
    color: var(--text-main);
    font: inherit;
    font-size: 16px;
    outline: none;
    box-shadow: inset 0 0 0 2px var(--qs-field-ring);
}

.qs .qs__input::placeholder {
    color: var(--text-light);
}

.qs__clear,
.qs__close {
    align-items: center;
    justify-content: center;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    cursor: pointer;
}

.qs__clear {
    display: inline-flex;
    width: 32px;
    height: 32px;
    margin-left: -89px;
}

.qs__input:placeholder-shown + .qs__clear {
    visibility: hidden;
}

.qs__clear svg {
    box-sizing: content-box;
    width: 12px;
    height: 12px;
    padding: 4px;
    border-radius: var(--radius-full);
    background: rgba(var(--text-light-rgb), 0.64);
    color: var(--qs-bg);
    transition: background-color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.qs__clear:hover svg {
    background: rgba(var(--text-light-rgb), 0.85);
}

.qs__close {
    display: inline-flex;
    width: 38px;
    height: 26px;
    margin: 0 11px 0 8px;
    border-radius: 7px;
    background: var(--qs-key-bg);
    box-shadow: inset 0 0 0 1px rgba(var(--text-light-rgb), 0.28);
    color: var(--qs-key-text);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    transition: color 0.15s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.qs__close:hover {
    box-shadow: inset 0 0 0 1px rgba(var(--text-light-rgb), 0.5);
    color: var(--text-main);
}

.qs__cancel {
    display: none;
}

.qs__clear:focus-visible,
.qs__close:focus-visible,
.qs__retry:focus-visible {
    outline: 2px solid var(--qs-field-ring);
    outline-offset: 2px;
}

.qs__field::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 38%;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0;
    pointer-events: none;
}

.qs.is-pending .qs__field::after {
    opacity: 1;
    transition: opacity 0s 0.45s;
    animation: qs-pending 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.qs.is-pending .qs-item {
    opacity: 0.45;
    transition: opacity 0.15s 0.45s, background-color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.qs__body {
    max-height: 522px;
    scroll-padding-top: 28px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--qs-scrollbar) transparent;
}

.qs__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 28px;
    padding: 0 16px 6px;
    background: var(--qs-bg);
    color: var(--qs-muted);
    font-size: 12.5px;
    font-weight: 500;
}

.qs__head[hidden] ~ .qs__empty {
    border-top: 1px solid var(--qs-divider);
}

.qs__head-note {
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
}

.qs__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 32px 32px;
    text-align: center;
}

.qs__empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    border-radius: 16px;
    background: var(--qs-fill);
}

.qs__empty strong {
    font-size: 18px;
    line-height: 24px;
    font-weight: 600;
}

.qs__empty span {
    max-width: 400px;
    font-size: 14px;
    line-height: 20px;
    color: var(--qs-muted);
}

.qs__retry {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    margin-top: 12px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--qs-btn-bg);
    color: var(--qs-btn-text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.qs__retry:hover {
    opacity: 0.85;
}

.qs-item {
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    transition: background-color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

/* .qs поднимает вес над a:hover и a:focus из styles.css */
.qs .qs-item {
    color: var(--text-main);
}

.qs-item:hover {
    background-color: var(--bg-hover);
}

.qs-item:focus-visible {
    outline: none;
    background-color: transparent;
    isolation: isolate;
}

.qs-item:focus-visible::after {
    content: "";
    position: absolute;
    inset: 3px 8px;
    z-index: -1;
    border-radius: 10px;
    box-shadow: inset 0 0 0 2px var(--qs-field-ring);
    background: rgba(250, 204, 21, 0.1);
    pointer-events: none;
}

.qs-item + .qs-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--qs-divider);
    pointer-events: none;
}

.qs-item:focus-visible::before,
.qs-item:focus-visible + .qs-item::before {
    opacity: 0;
}

.qs-item__poster {
    position: relative;
    isolation: isolate;
    width: 52px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--qs-poster-tint);
}

.qs-item__poster::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px var(--qs-poster-tint);
    pointer-events: none;
}

.qs-item__poster img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.qs-item__poster img.is-loaded {
    opacity: 1;
}

.qs-item__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.qs-item__line {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.qs-item__line + .qs-item__line {
    gap: 8px;
}

.qs-item__title {
    flex: 1 1 auto;
    min-width: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 20px;
}

.qs-item__aside {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex: none;
    font-size: 12.5px;
    line-height: 20px;
    color: var(--qs-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.qs-item--trend .qs-item__aside {
    font-size: 12px;
}

.qs-item__aside.is-hot {
    color: var(--danger);
    font-weight: 500;
}

.qs-item__flame {
    flex: none;
    width: 11px;
    height: 11px;
}

.qs-item__sub {
    display: contents;
    font-size: 12.5px;
    line-height: 18px;
    color: var(--qs-muted);
    white-space: nowrap;
}

.qs-item__year:empty {
    display: none;
}

.qs-item__ru {
    height: 17px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    background: rgba(var(--text-light-rgb), 0.12);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 17px;
    letter-spacing: 0.25px;
}

.qs-item__ru.is-voice {
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent-dark);
}

.qs-item__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    margin-left: 4px;
    color: #c2410c;
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
}

.qs-item__chip::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: currentColor;
}

@keyframes qs-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
}

@keyframes qs-fade {
    from {
        opacity: 0;
    }
}

@keyframes qs-pending {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(360%);
    }
}

.qs__foot {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: none;
    height: 36px;
    padding: 0 16px;
    border-top: 1px solid var(--qs-divider);
    color: var(--qs-muted);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.qs__foot span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.qs__foot kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    padding: 0 5px;
    border-radius: 5px;
    background: var(--qs-hint-bg);
    box-shadow: inset 0 0 0 1px var(--qs-hint-ring);
    color: var(--qs-key-text);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
}

.qs__foot kbd + kbd {
    margin-left: -4px;
}

.qs__foot .qs__key-arrow {
    width: 18px;
    padding: 0;
}

.qs__body[hidden] + .qs__foot {
    display: none;
}

.qs__body:has(> .qs__list:empty) + .qs__foot {
    display: none;
}

@media (hover: none), (max-width: 730px) {
    .qs__foot {
        display: none;
    }

    .qs__field {
        padding: 10px 6px 10px 12px;
        border-bottom: 1px solid var(--qs-divider);
    }

    .qs__head[hidden] ~ .qs__empty {
        border-top: 0;
    }

    .qs__icon {
        left: 24px;
        width: 18px;
        height: 18px;
        color: var(--text-light);
    }

    .qs .qs__input[type="text"] {
        height: 44px;
        padding: 0 40px;
        border-radius: 12px;
        background: var(--qs-fill);
        box-shadow: none;
        font-size: 17px;
    }

    .qs__clear {
        width: 36px;
        height: 36px;
        margin-left: -40px;
    }

    .qs__close,
    .qs__close:hover {
        width: auto;
        height: 44px;
        margin: 0 0 0 4px;
        padding: 0 10px;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        color: var(--text-main);
        font-size: 16px;
    }

    .qs__esc {
        display: none;
    }

    .qs__cancel {
        display: inline;
    }
}

@media (hover: none) {
    .qs-item:hover {
        background-color: transparent;
    }

    .qs-item:active {
        background-color: var(--bg-hover);
    }
}

@media (max-width: 730px) {
    .qs-trigger,
    html.dark .qs-trigger {
        justify-content: center;
        width: var(--header-icon-size);
        height: var(--header-icon-size);
        padding: 0;
        border: 0;
        border-radius: var(--header-icon-radius);
        background-color: transparent;
        box-shadow: none;
        color: var(--header-icon-color);
    }

    .qs-trigger:hover,
    html.dark .qs-trigger:hover {
        background-color: var(--header-icon-hover-bg);
    }

    .qs-trigger__icon,
    .qs-trigger:hover .qs-trigger__icon {
        width: 24px;
        height: 24px;
        color: inherit;
    }

    .qs-trigger__text {
        display: none;
    }

    .qs {
        width: 100%;
        max-height: 100dvh;
        margin: 0 0 auto;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }

    .qs__body {
        max-height: none;
    }

    .qs__head {
        padding: 0 12px 6px;
    }

    .qs-item {
        padding: 8px 12px;
    }

    .qs-item__poster {
        height: 64px;
    }
}

html.dark .qs {
    --qs-bg: var(--bg-tertiary);
    --qs-field-bg: rgba(250, 204, 21, 0.06);
    --qs-field-ring: rgba(250, 204, 21, 0.5);
    --qs-divider: rgba(255, 255, 255, 0.07);
    --qs-poster-tint: rgba(255, 255, 255, 0.06);
    --qs-scrollbar: rgba(255, 255, 255, 0.2);
    --qs-key-bg: rgba(255, 255, 255, 0.06);
    --qs-key-text: var(--text-secondary);
    --qs-fill: rgba(255, 255, 255, 0.07);
    --qs-muted: var(--text-light);
    --qs-hint-bg: rgba(255, 255, 255, 0.06);
    --qs-btn-bg: #fafafa;
    --qs-btn-text: #141414;
    --qs-hint-ring: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 1px var(--border-strong), 0 24px 64px rgba(0, 0, 0, 0.6);
}

html.dark .qs::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

html.dark .qs-item__chip {
    color: #fb923c;
}
