/* =============================================
   AniVerse — Library page
   ============================================= */

.av-library {
    display: flex;
    flex-direction: column;
    gap: var(--av-space-6);
}

/* --- Continue: panel composition (one dominant panel, two stacked) --- */
.av-continue {
    display: flex;
    flex-direction: column;
    gap: var(--av-space-3);
}

.av-continue-count {
    color: var(--av-text-2);
}

.av-continue-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--av-space-2);
}

.av-continue-panel {
    display: flex;
    gap: var(--av-space-4);
    min-width: 0;
    padding: 14px;
    background: var(--av-surface-1);
    border: 1px solid var(--av-line-strong);
    border-radius: var(--av-radius-panel);
    color: var(--av-text-1);
    text-decoration: none;
    transition: border-color var(--av-dur-fast) var(--av-ease-out), background-color var(--av-dur-fast) var(--av-ease-out);
}

.av-continue-panel:hover {
    color: var(--av-text-1);
    background: var(--av-surface-2);
    border-color: var(--av-line-hover);
}

.av-continue-cover {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    aspect-ratio: 2 / 3;
    align-self: flex-start;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 3px;
    background: var(--av-surface-2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.av-continue-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.av-continue-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.av-continue-title {
    font-family: var(--av-font-serif);
    font-size: 22px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.av-continue-spacer {
    flex: 1 1 auto;
    min-height: 4px;
}

.av-continue-progress {
    display: flex;
    justify-content: space-between;
    gap: var(--av-space-3);
    font-size: 12px;
    color: var(--av-text-2);
}

.av-continue-left {
    color: var(--av-text-3);
}

.av-continue-open {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    height: 34px;
    margin-top: 6px;
    padding: 0 10px 0 14px;
    border-radius: var(--av-radius-control);
    background: var(--av-text-1);
    color: var(--av-on-paper);
    font-size: var(--av-fs-small);
    font-weight: 600;
}

.av-continue-panel--lead .av-continue-cover {
    width: 88px;
}

.av-continue-panel--lead .av-continue-title {
    font-size: 26px;
    white-space: normal;
}

@media (min-width: 768px) {
    .av-continue-panels--2,
    .av-continue-panels--3 {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }

    .av-continue-panels--3 {
        grid-template-rows: repeat(2, minmax(0, 1fr));
        min-height: 272px;
    }

    .av-continue-panels--3 .av-continue-panel--lead {
        grid-row: 1 / span 2;
    }

    .av-continue-panel--lead {
        gap: var(--av-space-5);
        padding: 20px;
    }

    .av-continue-panel--lead .av-continue-cover {
        width: 150px;
    }

    .av-continue-panel--lead .av-continue-title {
        font-size: 36px;
        line-height: 1.08;
        letter-spacing: -0.01em;
    }

    .av-continue-panel:not(.av-continue-panel--lead) .av-continue-cover {
        width: 68px;
    }
}

/* --- Filters row: trailing figures + selection toggle --- */
.av-filters {
    display: flex;
    flex-direction: column;
    gap: var(--av-space-3);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--av-line);
}

.av-filters-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--av-space-2);
}

.av-filters-row--primary {
    justify-content: space-between;
    gap: var(--av-space-3) var(--av-space-4);
}

.av-filters-spacer {
    flex: 1 1 auto;
}

.av-figures {
    display: flex;
    flex-wrap: wrap;
    gap: 4px var(--av-space-4);
    padding-right: var(--av-space-2);
    font-size: 12px;
    color: var(--av-text-3);
}

.av-figures strong {
    color: var(--av-text-1);
    font-weight: 400;
}

/* --- Grid --- */
.av-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    column-gap: var(--av-space-3);
    row-gap: 20px;
}

.av-sentinel {
    display: flex;
    justify-content: center;
    padding: var(--av-space-5) 0;
}

/* --- Selection mode action bar --- */
.av-bulk-bar {
    position: sticky;
    bottom: calc(var(--av-tabbar-h) + var(--av-safe-bottom) + var(--av-space-3));
    z-index: 20;
    align-self: center;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--av-space-2);
    max-width: 100%;
    padding: 10px 12px;
    background: var(--av-surface-1);
    border: 1px solid var(--av-line-strong);
    border-radius: var(--av-radius-widget);
    box-shadow: var(--av-shadow-overlay);
}

.av-bulk-count {
    padding: 0 var(--av-space-2);
    font-size: var(--av-fs-small);
    font-weight: 500;
    white-space: nowrap;
}

.av-bulk-confirm {
    padding: 0 var(--av-space-1);
    font-size: var(--av-fs-small);
    color: var(--av-danger);
    white-space: nowrap;
}

/* --- Phones: full-width controls --- */
@media (max-width: 767px) {
    .av-filters-row--primary > .av-segmented,
    .av-filters-row--primary > .av-search {
        width: 100%;
    }

    .av-segmented-item {
        height: 36px;
    }

    .av-select,
    .av-filters .av-btn {
        height: 40px;
    }

    .av-select select {
        height: 38px;
    }

    .av-figures {
        order: 10;
        width: 100%;
        padding-top: var(--av-space-1);
    }

    .av-filters-spacer {
        display: none;
    }

    .av-card-title {
        font-size: 12px;
        line-height: 15px;
        min-height: 30px;
    }

    /* Narrow cards: the dot carries the status; its word stays available to assistive tech */
    .av-grid .av-card-status-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .av-grid .av-card-status {
        gap: 6px;
    }

    .av-grid .av-card-progress {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .av-grid .av-card-meta {
        font-size: 10px;
        letter-spacing: -0.01em;
    }
}

@media (min-width: 768px) {
    .av-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        column-gap: var(--av-space-5);
        row-gap: 36px;
    }
}

@media (min-width: 1024px) {
    .av-bulk-bar {
        bottom: var(--av-space-5);
    }
}
