.book-switcher {
    position: relative;
    flex: 0 0 auto;
    font-family: inherit;
}

.book-switcher__trigger {
    min-height: 42px;
    padding: 0.58rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.book-switcher__trigger:hover,
.book-switcher.is-open .book-switcher__trigger {
    background: rgba(255, 255, 255, 0.23);
    border-color: rgba(255, 255, 255, 0.56);
    transform: translateY(-1px);
}

.book-switcher__trigger:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.48);
    outline-offset: 3px;
}

.book-switcher__chevron {
    font-size: 0.68rem;
    transition: transform 0.2s ease;
}

.book-switcher.is-open .book-switcher__chevron {
    transform: rotate(180deg);
}

.book-switcher__menu {
    position: absolute;
    top: calc(100% + 0.7rem);
    right: 0;
    z-index: 120;
    width: min(328px, calc(100vw - 1.25rem));
    padding: 0.55rem;
    margin: 0;
    list-style: none;
    color: #25304a;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(99, 102, 241, 0.17);
    border-radius: 1rem;
    box-shadow: 0 24px 60px -22px rgba(30, 41, 59, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-7px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.book-switcher.is-open .book-switcher__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.book-switcher__item {
    width: 100%;
    min-height: 62px;
    padding: 0.72rem 0.78rem;
    border: 0;
    border-radius: 0.78rem;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.68rem;
    color: #27334f;
    background: transparent;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.book-switcher__item:hover:not(:disabled),
.book-switcher__item:focus-visible:not(:disabled) {
    color: #4f46e5;
    background: #f3f2ff;
    outline: none;
}

.book-switcher__item:disabled {
    cursor: default;
    background: linear-gradient(135deg, #f1f0ff, #fbf5ff);
}

.book-switcher__icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 8px 18px -11px rgba(79, 70, 229, 0.86);
}

.book-switcher__copy {
    min-width: 0;
}

.book-switcher__title,
.book-switcher__meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-switcher__title {
    font-size: 0.88rem;
    font-weight: 700;
}

.book-switcher__meta {
    margin-top: 0.16rem;
    color: #7a849d;
    font-size: 0.72rem;
}

.book-switcher__state {
    padding: 0.27rem 0.46rem;
    border-radius: 999px;
    color: #5b55cf;
    background: rgba(99, 102, 241, 0.11);
    font-size: 0.66rem;
    font-weight: 700;
    white-space: nowrap;
}

.book-switcher__item.is-loading .book-switcher__state::before {
    content: "";
    width: 10px;
    height: 10px;
    margin-right: 0.3rem;
    border: 2px solid rgba(91, 85, 207, 0.25);
    border-top-color: #5b55cf;
    border-radius: 50%;
    display: inline-block;
    vertical-align: -1px;
    animation: book-switcher-spin 0.75s linear infinite;
}

@keyframes book-switcher-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .book-switcher__trigger {
        width: 42px;
        padding: 0;
        justify-content: center;
    }

    .book-switcher__trigger-text,
    .book-switcher__chevron {
        display: none;
    }

    .book-switcher__menu {
        position: fixed;
        top: 72px;
        right: 0.625rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .book-switcher__trigger,
    .book-switcher__menu,
    .book-switcher__chevron {
        transition: none;
    }
}
