.library-page {
  background: #0c1015;
  color: #f8f7f5;
  font: 17px/1.55 "Source Sans 3", sans-serif;
  min-height: 100vh;
}
.library-page [hidden] { display: none !important; }
.library-page::before { height: 100vh; height: 100dvh; }
.library-shell { position: relative; width: min(1120px, 100%); margin: auto; padding: 36px 28px 64px; }
.library-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.author-link { font-size: 30px; font-weight: 600; line-height: 1.2; text-decoration: none; }
.author-link span { display: block; margin-top: 7px; font-size: 14px; font-weight: 300; color: #d4d4d6; }
.home-link { font-size: 15px; white-space: nowrap; padding: 12px 0; text-decoration: none; color: #e0dcda; }
.library-panel { padding: 38px; border: 1px solid #ffffff3d; border-radius: 26px; background: linear-gradient(135deg, #ffffff18, #ffffff0a), #101319c9; backdrop-filter: blur(7px); }
.eyebrow { font-size: 11px; letter-spacing: .2em; color: #d8c8b7; font-weight: 600; }
.library-intro h1 { font-size: clamp(30px, 4.5vw, 44px); font-weight: 600; line-height: 1.15; margin: 10px 0 12px; }
.library-intro > p:last-child { color: #ceccce; font-size: 16px; }
#search-form { margin-top: 28px; }
#search-form label { display: block; font-size: 14px; margin-bottom: 8px; }
.search-field { display: flex; align-items: center; gap: 12px; border: 1px solid #ffffff4d; border-radius: 12px; background: #080b1180; padding: 0 14px; }
.search-field:focus-within { border-color: #decfc0; box-shadow: 0 0 0 3px #decfc020; }
.search-field svg { width: 22px; height: 22px; flex-shrink: 0; color: #d8c8b7; }
#book-search { min-width: 0; width: 100%; min-height: 54px; padding: 12px 0; border: 0; outline: none; background: transparent; color: #fff; font: inherit; font-size: 16px; }
#book-search::placeholder { color: #a7a6ad; opacity: 1; }
#book-search::-webkit-search-cancel-button { -webkit-appearance: none; }
.library-page button { font: inherit; cursor: pointer; }
#clear-search { flex-shrink: 0; background: transparent; color: #e8e5e3; border: none; font-size: 26px; width: 44px; height: 44px; }
.category-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 28px; }
.category-filters button { min-height: 44px; border-radius: 24px; padding: 8px 15px; border: 1px solid #ffffff36; background: #ffffff08; color: #dddadd; font-size: 14px; }
.category-filters button[aria-pressed="true"] { color: #18191c; background: #e2d6c9; border-color: #e2d6c9; }
.results-toolbar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin-bottom: 18px; }
.results-toolbar h2 { font-size: 22px; font-weight: 600; }
#results-count { color: #bdbcc3; font-size: 14px; }
.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 18px; }
.book-card { min-width: 0; }
.book-content { display: block; height: 100%; border-radius: 12px; padding: 8px 8px 14px; background: #ffffff07; border: 1px solid #ffffff1f; text-decoration: none; transition: background .2s, border-color .2s, transform .2s; }
.book-cover { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 7px; background: linear-gradient(150deg, #414750, #1c212b 65%, #453a40); }
.book-card:nth-child(4n+2) .book-cover { background: linear-gradient(150deg, #514248, #252029 65%, #3c353f); }
.book-card:nth-child(4n+3) .book-cover { background: linear-gradient(150deg, #3d4d4b, #1c292b 65%, #3d4144); }
.book-card:nth-child(4n+4) .book-cover { background: linear-gradient(150deg, #574c43, #292427 65%, #3e3a3d); }
.cover-placeholder { position: absolute; inset: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; border: 1px solid #decfc033; padding: 12px; color: #e4d9cd; }
.cover-placeholder::before { content: "☾"; font: 48px/1 Georgia, serif; }
.cover-placeholder span { font: 18px/1.35 Georgia, serif; overflow-wrap: anywhere; }
.cover-placeholder small { font-size: 9px; letter-spacing: .2em; }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #191a20; }
.book-meta { display: block; color: #d5c4b3; font-size: 11px; margin: 13px 4px 5px; letter-spacing: .04em; }
.book-title { margin: 0 4px; font-size: 17px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.book-action { display: block; margin: 10px 4px 0; color: #c6c4ca; font-size: 12px; }
.empty-state { padding: 48px 16px; text-align: center; border: 1px dashed #ffffff33; border-radius: 12px; }
#empty-title { font-size: 24px; margin-bottom: 8px; }
#empty-description { color: #c6c4ca; }
.text-button { margin-top: 18px; min-height: 44px; border: 1px solid #ffffff55; border-radius: 8px; background: #ffffff10; color: #fff; padding: 8px 20px; }
.library-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 20px; border-top: 1px solid #ffffff26; font-size: 13px; color: #c5c0c4; }
.library-footer a { text-underline-offset: 4px; }
.notice { padding: 14px 18px; border: 1px solid #decfc04d; border-radius: 10px; background: #decfc012; font-size: 14px; margin-top: 20px; }
.library-page :focus-visible { outline: 2px solid #e2d6c9; outline-offset: 4px; }
@media (hover: hover) {
  a.book-action:hover { border-color: #decfc080; background: #ffffff12; }
  .category-filters button:hover { border-color: #decfc0; }
  .home-link:hover { color: white; }
}
@media (max-width: 900px) { .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .library-shell { padding: 24px 16px 36px; }
  .library-header { margin-bottom: 24px; }
  .author-link { font-size: 26px; }
  .author-link span { max-width: 195px; font-size: 12px; }
  .home-link { font-size: 13px; }
  .library-panel { padding: 24px 18px; border-radius: 20px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .book-content { padding: 6px 6px 12px; }
  .book-title { font-size: 16px; }
  .cover-placeholder { inset: 9px; padding: 8px; gap: 12px; }
  .cover-placeholder span { font-size: 14px; }
  .cover-placeholder::before { font-size: 32px; }
  .cover-placeholder small { font-size: 8px; letter-spacing: .12em; }
  .category-filters { gap: 7px; }
  .category-filters button { padding: 8px 12px; font-size: 13px; }
}
@media (max-width: 359px) { .book-grid { grid-template-columns: minmax(0, 1fr); } .book-cover { max-height: 290px; } }
@media (prefers-reduced-motion: reduce) { .library-page * { transition: none !important; } }

.book-actions { display: grid; gap: 8px; margin: 14px 4px 0; }
a.book-action { display: flex; align-items: center; min-height: 44px; margin: 0; padding: 9px 10px; border: 1px solid #ffffff33; border-radius: 7px; color: #e4d9cd; text-decoration: none; line-height: 1.45; overflow-wrap: anywhere; transition: background .2s, border-color .2s; }
