.library-page {
    display: grid;
    gap: 22px;
}

.library-page > h1 {
    font-size: clamp(16px, 3vw, 24px);
    line-height: 1.7;
}

.library-search {
    display: grid;
    gap: 10px;
    max-width: 760px;
    line-height: 1.8;
}

.library-search label {
    font-size: clamp(9px, 1vw, 11px);
}

.library-search-controls {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 10px;
}

.library-search input {
    flex: 1 1 240px;
    min-width: 0;
    padding: 11px 12px;
    color: var(--color-green);
    background: #000;
    border: 1px solid var(--color-green);
    border-radius: 8px;
}

.library-search button,
.library-search-controls > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 12px;
    color: var(--color-green);
    background: #000;
    border: 1px dashed var(--color-green);
    border-radius: 8px;
    font: inherit;
    font-size: 9px;
    text-decoration: none;
    cursor: pointer;
}

.library-search button:hover,
.library-search-controls > a:hover {
    color: #000;
    background: var(--color-green);
}

.library-tags,
.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.library-tags a,
.book-tags a {
    padding: 6px 9px;
    color: var(--color-green);
    border: 1px dashed currentColor;
    border-radius: 12px;
    font-size: 9px;
    line-height: 1.7;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.library-tags a:hover,
.book-tags a:hover,
.library-tags .tag-active {
    color: var(--color-green-hover);
}

.book-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.book-download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 10px;
    color: var(--color-green);
    border: 1px dashed currentColor;
    border-radius: 8px;
    font-size: 9px;
    line-height: 1.7;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.book-download-button:hover {
    color: #000;
    background: var(--color-green);
}

.library-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    align-items: stretch;
    gap: clamp(14px, 2vw, 22px);
}

.book-card {
    display: grid;
    align-content: start;
    min-width: 0;
    overflow: hidden;
    border: 2px dashed var(--color-green);
    border-radius: 12px;
}

.book-cover-link {
    display: block;
}

.book-card img {
    display: block;
    width: 100%;
    height: clamp(170px, 24vw, 280px);
    object-fit: cover;
}

.book-card-content {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: clamp(12px, 2vw, 18px);
}

.book-card h2 {
    font-size: clamp(11px, 1.4vw, 16px);
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.book-card h2 a {
    color: inherit;
    text-decoration: none;
}

.book-card h2 a:hover {
    color: var(--color-green-hover);
}

.book-description {
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(9px, 1vw, 11px);
    line-height: 1.8;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.book-card time,
.book-page time {
    font-size: 9px;
    line-height: 1.8;
    opacity: .75;
}

.library-empty {
    grid-column: 1 / -1;
    padding: 20px;
    border: 2px dashed var(--color-green);
    line-height: 1.8;
}

.book-back-link {
    color: inherit;
    line-height: 1.8;
}

.book-detail-cover {
    display: block;
    max-width: 100%;
    max-height: 65vh;
    justify-self: center;
    object-fit: contain;
    border: 1px dashed var(--color-green);
    border-radius: 10px;
}

@media (max-width: 600px) {
    .library-page { gap: 18px; }
    .library-search-controls { gap: 8px; }
    .library-search button,
    .library-search-controls > a { font-size: 8px; }
    .library-tags a,
    .book-tags a { font-size: 8px; }
    .library-gallery { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
    .book-card h2 { font-size: 10px; }
}
