.chapter-library-hero {
    position: relative;
    overflow: hidden;
    border-radius: 32px;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.24), transparent 28rem),
        linear-gradient(135deg, #5e60ce 0%, #6930c3 54%, #5390d9 100%);
    color: #fff;
    box-shadow: 0 24px 80px rgba(77, 66, 196, 0.22);
    margin-bottom: 2rem;
}

.chapter-library-hero__backdrop {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 34%),
        radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.1), transparent 18%);
    pointer-events: none;
}

.chapter-library-hero__content {
    position: relative;
    z-index: 1;
    padding: 2.75rem;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.chapter-library-hero h1 {
    max-width: 14ch;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.02;
    font-weight: 800;
    margin-bottom: 1rem;
}

.chapter-library-hero p {
    max-width: 62ch;
    font-size: 1.05rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
}

.hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.hero-stat-card,
.hero-focus-card {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
}

.hero-stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 148px;
    border-radius: 24px;
    padding: 1.4rem;
}

.hero-stat-card__label {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-stat-card strong {
    font-size: 2rem;
    line-height: 1;
}

.hero-stat-card span:last-child {
    color: rgba(255, 255, 255, 0.82);
}

.hero-focus-card {
    position: relative;
    border-radius: 28px;
    padding: 1.7rem;
    min-height: 100%;
}

.hero-focus-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(12, 17, 43, 0.18);
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-focus-card__value {
    font-size: clamp(3rem, 7vw, 4.5rem);
    line-height: 1;
    font-weight: 800;
}

.hero-focus-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.hero-focus-card p {
    margin: 0.8rem 0 1rem;
    color: rgba(255, 255, 255, 0.86);
}

.hero-focus-card__progress {
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

.hero-focus-card__progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #80ffdb 0%, #72efdd 45%, #64dfdf 100%);
}

.hero-focus-card__meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.9rem;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.section-heading h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: #23304d;
    margin: 0 0 0.35rem;
}

.section-heading p {
    color: #667085;
    margin: 0;
}

.section-action-link,
.section-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #5e60ce;
    font-weight: 700;
}

.subject-strip-section,
.chapter-library-grid-section,
.library-toolbar,
.subject-focus-panel {
    margin-bottom: 2rem;
}

.subject-strip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.subject-strip-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.2rem;
    background: #fff;
    border-radius: 22px;
    border: 1px solid rgba(94, 96, 206, 0.1);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.subject-strip-card:hover,
.subject-strip-card.active {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--subject-accent, #667eea) 34%, white);
    box-shadow: 0 18px 38px rgba(94, 96, 206, 0.12);
}

.subject-strip-card__icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.15rem;
    background: linear-gradient(135deg, var(--subject-accent, #667eea), color-mix(in srgb, var(--subject-accent, #667eea) 68%, white));
    flex-shrink: 0;
}

.subject-strip-card__content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.subject-strip-card__content strong {
    color: #1f2937;
    font-size: 1rem;
}

.subject-strip-card__content span,
.subject-strip-card__metric small {
    color: #667085;
}

.subject-strip-card__metric {
    margin-left: auto;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.subject-strip-card__metric span {
    color: #27366b;
    font-weight: 800;
    font-size: 1.1rem;
}

.library-toolbar__form {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.7fr) auto;
    gap: 1rem;
    padding: 1.25rem;
    background: #fff;
    border-radius: 24px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
}

.toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.toolbar-field label {
    color: #334155;
    font-weight: 700;
    font-size: 0.92rem;
}

.toolbar-input,
.toolbar-field select {
    min-height: 54px;
    border-radius: 18px;
    border: 1px solid rgba(100, 116, 139, 0.22);
    background: #f8fafc;
}

.toolbar-input {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
}

.toolbar-input i {
    color: #667eea;
}

.toolbar-input input,
.toolbar-field select {
    width: 100%;
    outline: none;
    box-shadow: none;
    font-size: 0.98rem;
}

.toolbar-input input {
    border: 0;
    background: transparent;
}

.toolbar-field select {
    padding: 0 1rem;
}

.toolbar-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.toolbar-btn-primary,
.toolbar-btn-secondary {
    min-height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.15rem;
    font-weight: 700;
}

.toolbar-btn-primary {
    background: linear-gradient(135deg, #667eea, #7c4dff);
    border: 0;
}

.toolbar-btn-secondary {
    border: 1px solid rgba(100, 116, 139, 0.16);
}

.subject-focus-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.4rem 1.5rem;
    border-radius: 26px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--subject-accent, #667eea) 12%, white), #fff);
    border: 1px solid color-mix(in srgb, var(--subject-accent, #667eea) 18%, white);
}

.subject-focus-panel__eyebrow {
    display: inline-block;
    color: var(--subject-accent, #667eea);
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.subject-focus-panel h2 {
    margin: 0 0 0.35rem;
    color: #1f2937;
    font-size: 1.7rem;
    font-weight: 800;
}

.subject-focus-panel p {
    margin: 0;
    color: #5b667b;
}

.subject-focus-panel__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 1rem;
}

.focus-metric {
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.focus-metric strong {
    display: block;
    color: #24325f;
    font-size: 1.45rem;
    font-weight: 800;
}

.focus-metric span {
    color: #667085;
    font-size: 0.92rem;
}

.chapter-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.25rem;
}

.chapter-library-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 360px;
    padding: 1.35rem;
    background: #fff;
    border-radius: 28px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.chapter-library-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--subject-accent, #667eea), color-mix(in srgb, var(--subject-accent, #667eea) 62%, white));
}

.chapter-library-card__topline,
.chapter-library-card__meta,
.chapter-library-card__progress-meta,
.chapter-library-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

.chapter-library-card__subject,
.chapter-library-card__reading-time {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #5b667b;
    font-size: 0.9rem;
}

.chapter-library-card h3 {
    color: #1f2937;
    font-size: 1.38rem;
    line-height: 1.2;
    font-weight: 800;
    margin: 0;
}

.chapter-library-card p {
    margin: 0;
    color: #5b667b;
    line-height: 1.75;
}

.chapter-library-card__meta strong,
.chapter-library-card__progress-meta span:last-child {
    color: #27366b;
}

.chapter-library-card__progress {
    margin-top: auto;
}

.chapter-library-card__progress-track {
    height: 11px;
    border-radius: 999px;
    background: #eef2ff;
    overflow: hidden;
}

.chapter-library-card__progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--subject-accent, #667eea), color-mix(in srgb, var(--subject-accent, #667eea) 65%, white));
}

.chapter-library-card__progress-meta {
    margin-top: 0.55rem;
    color: #667085;
    font-size: 0.88rem;
}

.chapter-library-card__actions {
    margin-top: 0.35rem;
}

.chapter-library-card__btn-primary,
.chapter-library-card__btn-secondary {
    flex: 1;
    min-height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    font-weight: 700;
}

.chapter-library-card__btn-primary {
    background: linear-gradient(135deg, var(--subject-accent, #667eea), color-mix(in srgb, var(--subject-accent, #667eea) 55%, #7c4dff));
    border: 0;
}

.chapter-library-card__btn-secondary {
    border: 1px solid rgba(100, 116, 139, 0.16);
}

.library-empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 3rem 1.5rem;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
}

.library-empty-state__icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    color: #667eea;
    background: #eef2ff;
    font-size: 1.5rem;
}

.library-empty-state h3 {
    color: #1f2937;
    margin: 0;
}

.library-empty-state p {
    color: #667085;
    max-width: 56ch;
    margin: 0;
}

.library-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.7rem;
    margin-top: 1.75rem;
}

.library-pagination__btn {
    min-width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #334155;
    font-weight: 700;
    text-decoration: none;
}

.library-pagination__btn.active {
    background: linear-gradient(135deg, #667eea, #7c4dff);
    border-color: transparent;
    color: #fff;
}

@media (max-width: 1199.98px) {
    .hero-stats-grid,
    .subject-focus-panel__metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .chapter-library-hero__content,
    .subject-focus-panel {
        padding: 1.5rem;
    }

    .library-toolbar__form {
        grid-template-columns: 1fr;
    }

    .toolbar-actions {
        align-items: stretch;
        justify-content: stretch;
    }

    .toolbar-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .chapter-library-hero h1 {
        max-width: none;
    }

    .hero-stats-grid,
    .subject-focus-panel__metrics {
        grid-template-columns: 1fr;
    }

    .subject-focus-panel,
    .section-heading,
    .chapter-library-card__actions,
    .chapter-library-card__topline,
    .chapter-library-card__meta,
    .chapter-library-card__progress-meta,
    .hero-focus-card__meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .chapter-library-card__actions .btn {
        width: 100%;
    }
}
