/* ==========================================
   БИБЛИОТЕКА: одна строка из двух блоков —
   «Продолжить просмотр» слева, «Избранное» справа
   ==========================================
   Значения 1-в-1 как у .mg-continue-fav-row в style_manga.css,
   чтобы верхняя часть каталогов аниме и манги совпадала. */

/* .lib-strip общий с мангой (там класс .mg-continue-scroll lib-strip),
   поэтому полосы уже идентичны и здесь не переопределяются. */

.lib-wrap {
    display: flex;
    gap: 40px;
    margin: 24px 0 8px;
    animation: libFade .4s ease both;
}

@keyframes libFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.lib-col {
    flex: 1;
    min-width: 0;
}

.lib-sec[hidden] {
    display: none;
}

/* Как .mg-cf-head: отступ 0 4px и margin-bottom 12px */
.lib-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.lib-head h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.lib-head h3 svg {
    width: 17px;
    height: 17px;
    color: #ff8fa3;
    flex-shrink: 0;
}

.lib-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid #2c2e36;
    color: #8b8e98;
    font-family: 'MyCustomFont';
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s;
    flex-shrink: 0;
}

.lib-clear:hover {
    color: #f87171;
    border-color: rgba(248, 113, 113, .5);
}

.lib-clear svg {
    width: 13px;
    height: 13px;
}

/* ---------- Полосы со скроллом внутри своего блока ---------- */
.lib-strip {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    scrollbar-width: none;
}

.lib-strip::-webkit-scrollbar {
    display: none;
}

/* ---------- Карточки: 150px и градиент 1-в-1 как у .mg-mini-card ---------- */
.lib-card {
    position: relative;
    flex: 0 0 150px;
    width: 150px;
    aspect-ratio: 2/3;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #2c2e36;
    background: #1d1e24;
    display: block;
    text-decoration: none;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.lib-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 77, 109, .55);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .5), 0 0 18px rgba(255, 77, 109, .18);
}

.lib-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lib-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 10px 9px;
    background: linear-gradient(0deg, rgba(8, 9, 12, .95) 0%, rgba(8, 9, 12, .65) 55%, transparent 100%);
}

.lib-info b {
    display: block;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lib-info span {
    display: block;
    color: #c9ccd4;
    font-size: 10.5px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lib-prog {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(255, 255, 255, .14);
}

.lib-prog i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #ff4d6d, #ff8fa3);
    box-shadow: 0 0 8px rgba(255, 77, 109, .7);
}

.lib-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 77, 109, .85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(.8);
    transition: all .2s ease;
    pointer-events: none;
}

.lib-play svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
}

.lib-card:hover .lib-play {
    opacity: 1;
    transform: scale(1);
}

.lib-card-fav .lib-play {
    pointer-events: auto;
    cursor: pointer;
}

.lib-heart {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(13, 14, 17, .75);
    backdrop-filter: blur(6px);
    color: #ff4d6d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lib-heart svg {
    width: 14px;
    height: 14px;
}

/* ---------- Кнопка «В избранное» на странице аниме ---------- */
.lib-fav-btn.active {
    color: #ff4d6d !important;
    border-color: rgba(255, 77, 109, .6) !important;
}

/* ---------- Модалка подтверждения очистки (наш стиль) ---------- */
.lib-confirm-card {
    width: min(430px, calc(100% - 32px));
}

.lib-confirm-text {
    margin: 0;
    color: #b8bcc6;
    font-size: 13.5px;
    line-height: 1.6;
}

/* ---------- Тост ---------- */
.lib-toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    z-index: 400;
    background: rgba(13, 14, 17, .92);
    border: 1px solid rgba(255, 77, 109, .5);
    color: #fff;
    font-family: 'MyCustomFont';
    font-size: 13px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: all .25s;
    pointer-events: none;
}

.lib-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Адаптив (те же значения, что у .mg-continue-fav-row) ---------- */
@media (max-width: 900px) {
    .lib-wrap {
        flex-direction: column;
        gap: 18px;
    }
}

.lib-chevron {
    display: none;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    transition: transform .2s ease;
    color: #8b8e98;
}

@keyframes libSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    /* Как .mg-continue-fav-row: flex-колонка, gap 8, margin 10px 0 12px */
    .lib-wrap {
        flex-direction: column !important;
        gap: 8px !important;
        margin: 10px 0 12px !important;
    }

    .lib-chevron {
        display: inline-block !important;
    }

    .lib-head {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 9px 12px !important;
        background: #17181f !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 12px !important;
        margin-bottom: 6px !important;
        cursor: pointer !important;
        user-select: none !important;
    }

    .lib-head h3 {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        margin: 0 !important;
        font-size: 13.5px !important;
        font-weight: 700 !important;
    }

    .lib-sec:not(.open) .lib-strip {
        display: none !important;
    }

    .lib-sec.open .lib-strip {
        display: flex !important;
        animation: libSlideDown .25s ease both !important;
    }

    .lib-sec.open .lib-chevron {
        transform: rotate(180deg) !important;
    }

    .lib-clear {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }

    /* Полоса на мобиле намеренно НЕ переопределяется:
       в манге .mg-continue-scroll тоже сохраняет базовые gap 14px
       и padding 4px 2px 10px — так полосы выглядят одинаково. */

    .lib-card {
        flex-basis: 115px !important;
        width: 115px !important;
        border-radius: 11px !important;
        position: relative !important;
    }

    .lib-info {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 3 !important;
        display: block !important;
        padding: 20px 8px 6px !important;
        background: linear-gradient(0deg, rgba(8, 9, 12, 0.95) 0%, rgba(8, 9, 12, 0.65) 55%, transparent 100%) !important;
    }

    .lib-info b {
        display: block !important;
        color: #fff !important;
        font-size: 11.5px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .lib-info span {
        display: block !important;
        color: #c9ccd4 !important;
        font-size: 9.5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* ---------- Плавный фейд краёв полос (как page-fade, но горизонтально) ---------- */
.lib-strip {
    -webkit-mask-image: none;
    mask-image: none;
}

.lib-strip.fade-right:not(.fade-left) {
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 70px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 70px), transparent 100%);
}

.lib-strip.fade-left:not(.fade-right) {
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 70px, #000 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 70px, #000 100%);
}

.lib-strip.fade-left.fade-right {
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 70px, #000 calc(100% - 70px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 70px, #000 calc(100% - 70px), transparent 100%);
}