.library-page {
    --library-ink: #24252a;
    --library-muted: #626b73;
    --library-teal: #08c2cf;
    --library-teal-dark: #01929c;
    --library-mint: #e3f9fa;
    --library-yellow: #f8ca73;
    --library-coral: #08c2cf;
    --library-paper: #fffdfa;
    --library-line: #dcebed;
    min-height: 70vh;
    color: var(--library-ink);
    background: var(--library-paper);
    font-family: Montserrat, "Montserrat-Alternates", sans-serif;
}

.library-container {
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
}

.library-hero {
    padding: 78px 0 72px;
    background:
        radial-gradient(circle at 84% 22%, rgba(248, 202, 115, 0.62) 0 8%, transparent 8.5%),
        linear-gradient(135deg, #eafafb 0%, #f7fcfc 54%, #fff6e4 100%);
    border-bottom: 1px solid var(--library-line);
}

.library-hero--personal {
    background:
        radial-gradient(circle at 84% 24%, rgba(248, 202, 115, 0.3) 0 10%, transparent 10.5%),
        linear-gradient(135deg, #e6f9fa 0%, #f6fcfc 48%, #fff7e7 100%);
}

.library-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    align-items: end;
    gap: 72px;
}

.library-eyebrow {
    margin: 0 0 16px;
    color: var(--library-teal);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.library-hero h1 {
    max-width: 780px;
    margin: 0;
    color: var(--library-ink);
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 800;
    line-height: 1.03;
    letter-spacing: -0.055em;
}

.library-hero h1 span {
    color: var(--library-teal);
}

.library-hero h1 + p {
    max-width: 700px;
    margin: 24px 0 0;
    color: var(--library-muted);
    font-size: 17px;
    line-height: 1.65;
}

.library-search,
.learning-note {
    padding: 24px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(24, 34, 44, 0.09);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(6, 17, 37, 0.1);
}

.library-search label {
    display: block;
    margin-bottom: 10px;
    color: var(--library-ink);
    font-size: 13px;
    font-weight: 800;
}

.library-search > div {
    display: flex;
    gap: 8px;
}

.library-search input {
    min-width: 0;
    flex: 1;
    padding: 14px 16px;
    color: var(--library-ink);
    background: #fff;
    border: 1px solid #cedad5;
    border-radius: 13px;
    outline: none;
}

.library-search input:focus {
    border-color: var(--library-teal);
    box-shadow: 0 0 0 3px rgba(8, 194, 207, 0.16);
}

.library-search button {
    padding: 14px 18px;
    color: #fff;
    background: var(--library-teal);
    border: 0;
    border-radius: 13px;
    font-weight: 800;
    cursor: pointer;
}

.learning-note {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.learning-note > span {
    width: 40px;
    height: 40px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    color: var(--library-teal-dark);
    background: var(--library-yellow);
    border-radius: 50%;
    font-weight: 900;
}

.learning-note p {
    display: grid;
    gap: 7px;
    margin: 0;
    color: var(--library-muted);
    font-size: 13px;
    line-height: 1.5;
}

.learning-note strong {
    color: var(--library-ink);
    font-size: 15px;
}

.library-catalogue {
    padding: 82px 0 110px;
}

.library-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 34px;
}

.library-section-heading span {
    color: var(--library-teal);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.library-section-heading h2 {
    margin: 5px 0 0;
    color: var(--library-ink);
    font-size: clamp(32px, 5vw, 50px);
    line-height: 1;
    letter-spacing: -0.045em;
}

.library-section-heading > a {
    padding-bottom: 6px;
    color: var(--library-teal);
    font-size: 13px;
    font-weight: 800;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.library-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--library-line);
    border-radius: 28px;
    box-shadow: 0 16px 45px rgba(6, 17, 37, 0.07);
}

.library-card--recent {
    border-color: rgba(8, 194, 207, 0.52);
    box-shadow: 0 18px 50px rgba(8, 194, 207, 0.14);
}

.library-card__cover {
    position: relative;
    isolation: isolate;
    min-height: 100%;
    overflow: hidden;
    padding: 22px;
    color: #fff;
    background: #061125;
}

.library-card__cover-image {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 200px;
    height: 200px;
    max-width: none;
    object-fit: cover;
}

.library-card__cover::before,
.library-card__cover::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
}

.library-card__cover::before {
    width: 160px;
    height: 160px;
    top: 28%;
    left: -80px;
    background: var(--library-teal);
}

.library-card__cover::after {
    width: 110px;
    height: 110px;
    right: -35px;
    bottom: -28px;
    background: var(--library-yellow);
}

.library-card__language,
.library-card__edition {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.library-card__edition {
    position: absolute;
    right: 20px;
    bottom: 17px;
    color: #24252a;
    font-size: 20px;
}

.library-card__code {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 136px;
    padding: 18px 14px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
    transform: translate(-50%, -50%) rotate(-4deg);
}

.library-card__code i {
    width: 7px;
    height: 7px;
    display: inline-block;
    margin-right: 2px;
    background: var(--library-coral);
    border-radius: 50%;
}

.library-card__code i:nth-child(2) { background: var(--library-yellow); }
.library-card__code i:nth-child(3) { background: var(--library-teal); }

.library-card__code b,
.library-card__code strong {
    display: inline-block;
    margin-top: 20px;
    color: var(--library-teal);
    font-family: monospace;
    font-size: 13px;
}

.library-card__code strong {
    color: var(--library-ink);
}

.library-card__body {
    min-width: 0;
    display: flex;
    padding: 26px;
    flex-direction: column;
}

.library-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.library-card__badges span {
    padding: 6px 8px;
    color: var(--library-teal-dark);
    background: var(--library-mint);
    border-radius: 8px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.library-card__badges .is-recent { color: #6b4a00; background: #fff1d3; }
.library-card__badges .is-favorite { color: #006d75; background: #dff7f9; }

.library-card h2 {
    margin: 0;
    color: var(--library-ink);
    font-size: 24px;
    line-height: 1.14;
    letter-spacing: -0.03em;
}

.library-card h2 a:hover {
    color: var(--library-teal);
}

.library-card__description {
    margin: 12px 0 16px;
    color: var(--library-muted);
    font-size: 13px;
    line-height: 1.55;
}

.library-card__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 16px;
}

.library-card__facts span {
    padding: 7px 9px;
    color: #5b676f;
    background: #f3f5f3;
    border-radius: 9px;
    font-size: 10px;
}

.library-card__facts strong {
    color: var(--library-ink);
}

.library-card__lessons {
    display: grid;
    gap: 3px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.library-card__lessons a {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    overflow: hidden;
    color: #4f5d65;
    border-radius: 8px;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-card__lessons a:hover {
    color: var(--library-teal-dark);
    background: #e9f9fa;
}

.library-card__lessons span {
    color: #8b969d;
    font-size: 9px;
    font-weight: 800;
}

.library-card__progress {
    margin-top: auto;
    margin-bottom: 16px;
}

.library-card__progress > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
    color: var(--library-muted);
    font-size: 10px;
    font-weight: 700;
}

.library-card__progress strong {
    color: var(--library-teal-dark);
}

.library-card__progress progress {
    width: 100%;
    height: 7px;
    display: block;
    overflow: hidden;
    appearance: none;
    background: #e5eae7;
    border: 0;
    border-radius: 999px;
}

.library-card__progress progress::-webkit-progress-bar { background: #e5eae7; }
.library-card__progress progress::-webkit-progress-value { background: var(--library-teal); border-radius: 999px; }
.library-card__progress progress::-moz-progress-bar { background: var(--library-teal); border-radius: 999px; }

.library-card__actions {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
}

.library-card__actions form {
    margin: 0;
}

.library-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 17px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
}

.library-button--primary {
    color: #fff;
    background: var(--library-teal);
}

.library-button--primary:hover,
.library-button--primary:focus-visible {
    background: var(--library-teal-dark);
    outline: none;
}

.library-favorite {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #69757d;
    background: #fff;
    border: 1px solid #d7dfdb;
    border-radius: 12px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.library-favorite:hover,
.library-favorite:focus-visible,
.library-favorite.is-active {
    color: #6b4a00;
    background: #fff1d3;
    border-color: var(--library-yellow);
    outline: none;
}

.library-empty {
    display: grid;
    justify-items: center;
    padding: 70px 28px;
    color: var(--library-muted);
    background: #f6f8f5;
    border: 1px dashed #cdd7d1;
    border-radius: 28px;
    text-align: center;
}

.library-empty > span {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    color: var(--library-teal-dark);
    background: var(--library-yellow);
    border-radius: 22px;
    font-size: 30px;
    transform: rotate(-4deg);
}

.library-empty h2 {
    margin: 0;
    color: var(--library-ink);
    font-size: 28px;
}

.library-empty p {
    max-width: 560px;
    margin: 12px 0 24px;
    line-height: 1.6;
}

@media (max-width: 1080px) {
    .library-grid { grid-template-columns: 1fr; }
    .library-card { grid-template-columns: 200px minmax(0, 1fr); }
}

@media (max-width: 800px) {
    .library-hero { padding: 58px 0; }
    .library-hero__grid { grid-template-columns: 1fr; gap: 34px; }
    .library-search,
    .learning-note { max-width: 620px; }
}

@media (max-width: 620px) {
    .library-container { width: min(100% - 28px, 1180px); }
    .library-hero h1 { font-size: clamp(38px, 12vw, 54px); }
    .library-search > div { flex-direction: column; }
    .library-section-heading { align-items: flex-start; flex-direction: column; }
    .library-card { grid-template-columns: 1fr; }
    .library-card__cover { min-height: 200px; }
    .library-card__cover-image {
        left: 50%;
        transform: translateX(-50%);
    }
    .library-card__body { padding: 22px; }
    .library-card__lessons a { white-space: normal; }
    .library-catalogue { padding: 62px 0 82px; }
}

@media (prefers-reduced-motion: reduce) {
    .library-page *,
    .library-page *::before,
    .library-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
