/* ==========================================================================
   久存网 · 我的数字图书馆
   ========================================================================== */

.library-page .user-main {
    min-width: 0;
}

.library-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    min-height: 264px;
    overflow: hidden;
    padding: 25px 27px;
    border-radius: 17px;
    color: #fff;
    background:
        radial-gradient(500px 260px at 88% 10%, rgba(151, 222, 255, 0.36), transparent 65%),
        linear-gradient(130deg, #2f6fb5 0%, #3d8bd4 55%, #62afe6 100%);
    box-shadow: 0 18px 35px rgba(43, 106, 170, 0.16);
}

.library-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 0.6px, transparent 0.6px);
    background-size: 25px 25px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 80%);
    pointer-events: none;
}

.library-hero-copy {
    position: relative;
    z-index: 2;
    align-self: center;
}

.library-hero-copy .eyebrow {
    color: rgba(255, 255, 255, 0.58);
    font-size: 8px;
}

.library-hero-copy h1 {
    margin: 6px 0 6px;
    font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
    font-size: clamp(29px, 3.1vw, 39px);
    line-height: 1.3;
    letter-spacing: -0.035em;
}

.library-hero-copy > p {
    max-width: 450px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    line-height: 1.8;
}

.library-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin-top: 17px;
}

.library-stats div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.library-stats strong {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.library-stats span {
    color: rgba(255, 255, 255, 0.52);
    font-size: 8px;
}

.library-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 17px;
}

.library-hero-actions .btn {
    min-height: 32px;
    font-size: 9px;
}

.library-hero-actions .btn-outline {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.library-hero-actions .btn-outline:hover {
    border-color: rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.16);
}

.library-shelf-visual {
    position: relative;
    z-index: 1;
    min-height: 216px;
}

.library-shelf-book {
    position: absolute;
    display: block;
    overflow: hidden;
    width: 83px;
    height: 124px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    background: #6ca7d8;
    box-shadow: 0 15px 28px rgba(9, 51, 92, 0.25);
    transition: transform 0.25s var(--ease);
}

.library-shelf-book:hover {
    transform: translateY(-4px) rotate(0deg) !important;
}

.library-shelf-book img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-shelf-book > span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.65);
}

.library-shelf-book > span .icon {
    width: 25px;
    height: 25px;
}

.shelf-book-1 {
    left: 30px;
    top: 45px;
    z-index: 1;
    transform: rotate(-9deg);
}

.shelf-book-2 {
    left: 85px;
    top: 20px;
    z-index: 3;
    transform: rotate(-1deg);
}

.shelf-book-3 {
    left: 143px;
    top: 33px;
    z-index: 2;
    transform: rotate(6deg);
}

.shelf-book-4 {
    left: 204px;
    top: 55px;
    z-index: 1;
    transform: rotate(11deg);
    opacity: 0.8;
}

.shelf-book-5 {
    left: 245px;
    top: 75px;
    z-index: 0;
    transform: rotate(15deg);
    opacity: 0.6;
}

.library-shelf-caption {
    position: absolute;
    left: 31px;
    bottom: 5px;
    color: rgba(255, 255, 255, 0.38);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 6.5px;
    letter-spacing: 0.2em;
}

.library-shelf-empty {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    transform: translate(-50%, -50%);
}

.library-shelf-empty .icon {
    width: 30px;
    height: 30px;
}

.library-shelf-empty small {
    font-size: 8px;
    line-height: 1.6;
}

.library-section {
    margin-top: 24px;
}

.library-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.library-section-head .eyebrow {
    margin-bottom: 3px;
    font-size: 7.5px;
}

.library-section-head h2 {
    font-family: "Songti SC", "STSong", serif;
    font-size: 22px;
    letter-spacing: -0.025em;
}

.library-section-head > a,
.library-section-note {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
    color: #8ca2b7;
    font-size: 8px;
}

.library-section-head > a {
    color: var(--blue-600);
}

.library-section-head > a .icon,
.library-section-note .icon {
    width: 10px;
    height: 10px;
}

.library-reading-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 11px;
}

.library-reading-card {
    display: flex;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid #e1eefb;
    border-radius: 10px;
    background: #fbfdff;
}

.library-reading-cover {
    flex: 0 0 auto;
    width: 48px;
    height: 70px;
    overflow: hidden;
    border-radius: 3px;
    background: #e6f2ff;
}

.library-reading-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-reading-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.library-reading-cat {
    color: #9aafc2;
    font-size: 7px;
}

.library-reading-body > a:nth-child(2) {
    overflow: hidden;
    margin: 1px 0 1px;
    color: #4a6680;
    font-family: "Songti SC", "STSong", serif;
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-reading-body small {
    color: #a2b3c4;
    font-size: 7.5px;
}

.library-progress {
    height: 3px;
    overflow: hidden;
    margin: 7px 0 0;
    border-radius: 999px;
    background: #e6f1fb;
}

.library-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6dbbf7, #2f7cf6);
}

.library-continue {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 7px;
    color: var(--blue-600);
    font-size: 8px;
    font-weight: 500;
}

.library-continue .icon {
    width: 9px;
    height: 9px;
}

.library-purchased-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
}

.library-purchased-card {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 200px;
    padding: 8px;
    border: 1px solid #e5eef8;
    border-radius: 8px;
    background: #fbfdff;
}

.library-purchased-card img {
    width: 31px;
    height: 44px;
    border-radius: 2px;
    object-fit: cover;
}

.library-purchased-card > span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.library-purchased-card strong {
    overflow: hidden;
    color: #58748d;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-purchased-card small {
    color: #a3b4c5;
    font-size: 7px;
}

.library-purchased-card > .icon {
    width: 10px;
    height: 10px;
    color: #b2c2d1;
}

.library-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.library-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.library-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 9px;
    border-radius: 5px;
    color: #8299af;
    font-size: 9px;
}

.library-tabs a small {
    padding: 1px 3px;
    border-radius: 3px;
    color: #a6b6c7;
    background: #f2f8fd;
    font-size: 7px;
}

.library-tabs a:hover {
    color: var(--blue-600);
    background: var(--blue-50);
}

.library-tabs a.is-active {
    color: #fff;
    background: var(--blue-500);
}

.library-tabs a.is-active small {
    color: #dbefff;
    background: rgba(255, 255, 255, 0.14);
}

.library-search {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
    padding: 0 4px 0 8px;
    border: 1px solid #e2edf9;
    border-radius: 6px;
    background: #fbfdff;
}

.library-search > span {
    display: grid;
    place-items: center;
    color: #a9bacb;
}

.library-search > span .icon {
    width: 12px;
    height: 12px;
}

.library-search input[type="search"] {
    width: 120px;
    border: 0;
    outline: 0;
    color: #607b94;
    background: transparent;
    font-size: 8.5px;
}

.library-search select {
    border: 0;
    outline: 0;
    color: #8a9fb3;
    background: transparent;
    font-size: 8px;
}

.library-search button {
    height: 23px;
    padding: 0 7px;
    border-radius: 4px;
    color: var(--blue-600);
    background: #eef8ff;
    font-size: 8px;
}

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

.library-book-card,
.library-item-card {
    display: flex;
    min-width: 0;
    gap: 11px;
    padding: 10px;
    border: 1px solid #e4effa;
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-xs);
}

.library-book-card:hover,
.library-item-card:hover {
    border-color: #cfe4fb;
}

.library-book-cover {
    position: relative;
    display: block;
    flex: 0 0 82px;
    height: 116px;
    overflow: hidden;
    border-radius: 4px;
    background: #e7f2fd;
}

.library-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-book-cover > span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #9abdd9;
}

.library-book-cover > span .icon {
    width: 25px;
    height: 25px;
}

.library-book-cover em,
.library-item-cover em {
    position: absolute;
    left: 4px;
    bottom: 4px;
    padding: 2px 4px;
    border-radius: 2px;
    color: #fff;
    background: rgba(20, 58, 95, 0.55);
    font-style: normal;
    font-size: 6.5px;
}

.library-book-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.library-book-title,
.library-item-title {
    overflow: hidden;
    color: #365674;
    font-family: "Songti SC", "STSong", serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-book-author {
    color: #99adc0;
    font-size: 7.5px;
}

.library-book-body > p,
.library-item-body > p {
    display: -webkit-box;
    overflow: hidden;
    margin: 4px 0 5px;
    color: #8a9fb3;
    font-family: "Songti SC", "STSong", serif;
    font-size: 8.5px;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.library-book-body .library-progress {
    margin: 3px 0;
}

.library-item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    margin-top: auto;
    padding-top: 7px;
    border-top: 1px solid #f0f7fd;
    color: #a2b3c4;
    font-size: 7.5px;
}

.library-item-foot > span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.library-item-foot .icon {
    width: 9px;
    height: 9px;
}

.library-item-foot form {
    display: inline-flex;
}

.library-item-foot button {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #a0b1c2;
    font-size: 7.5px;
}

.library-item-foot button:hover {
    color: #c36b73;
}

.library-item-cover {
    position: relative;
    display: block;
    flex: 0 0 92px;
    height: 72px;
    overflow: hidden;
    border-radius: 4px;
    background: #e7f2fd;
}

.library-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-item-cover > span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #a0bfd7;
}

.library-item-cover > span .icon {
    width: 23px;
    height: 23px;
}

.library-item-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.library-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 55px 20px;
    border: 1px dashed #d2e4f6;
    border-radius: 13px;
    text-align: center;
}

.library-empty > span:first-child {
    color: #bed4e8;
}

.library-empty > span:first-child .icon {
    width: 31px;
    height: 31px;
}

.library-empty .eyebrow {
    margin-top: 6px;
    font-size: 7.5px;
}

.library-empty h2 {
    margin: 5px 0;
    font-family: "Songti SC", "STSong", serif;
    font-size: 21px;
}

.library-empty p {
    color: #93a7ba;
    font-size: 9px;
}

.library-empty > div {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

@media (max-width: 1180px) {
    .library-hero {
        grid-template-columns: minmax(0, 1fr) 230px;
    }

    .shelf-book-4,
    .shelf-book-5 {
        display: none;
    }

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

@media (max-width: 820px) {
    .library-page .user-layout {
        display: block;
    }

    .library-page .user-sidebar {
        display: none;
    }

    .library-page .user-main {
        width: 100%;
    }

    .library-hero {
        display: block;
        padding: 20px;
    }

    .library-shelf-visual {
        display: none;
    }

    .library-hero-copy h1 {
        font-size: 29px;
    }

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

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

    .library-search {
        width: 100%;
    }

    .library-search input[type="search"] {
        flex: 1;
        width: auto;
    }

    .library-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .library-tabs {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    .library-tabs a {
        flex: 0 0 auto;
    }
}

@media (max-width: 520px) {
    .library-hero {
        margin-inline: 0;
        border-radius: 13px;
    }

    .library-stats {
        gap: 14px;
    }

    .library-stats strong {
        font-size: 17px;
    }

    .library-hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .library-hero-actions .btn {
        width: 100%;
    }

    .library-section-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .library-book-card,
    .library-item-card {
        padding: 8px;
    }

    .library-book-cover {
        flex-basis: 72px;
        height: 103px;
    }

    .library-item-cover {
        flex-basis: 78px;
        height: 62px;
    }

    .library-book-title,
    .library-item-title {
        font-size: 13px;
    }

    .library-search {
        flex-wrap: wrap;
        height: auto;
        padding: 6px;
    }

    .library-search input[type="search"] {
        min-width: 90px;
    }

    .library-search select {
        margin-left: 18px;
    }

    .library-search button {
        margin-left: auto;
    }
}
