:root { color-scheme: light; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #203746; background: #f4f8fb; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.catalog { max-width: 1504px; margin: auto; padding: 24px 24px 40px; }
.eyebrow { margin: 0 0 8px; color: #006699; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.intro { margin: 0; color: #566d7c; line-height: 1.6; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 16px; padding: 12px 0; border-block: 1px solid #d5e3ec; }
.sort { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .9rem; }
.sort span { margin-right: 8px; color: #566d7c; }
.sort a { color: #006699; text-decoration: none; padding: 10px 16px; border-radius: 24px; }
.sort a:hover { background: #dfedf5; }
.sort a[aria-current] { background: #006699; color: white; }
#search { width: min(100%, 360px); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
input { width: 100%; font: inherit; border: 1px solid #aac5d6; background: white; color: inherit; border-radius: 8px; padding: 12px 14px; }
a:focus-visible, input:focus-visible { outline: 3px solid #006699; outline-offset: 4px; }
.result-count { color: #566d7c; font-size: .85rem; margin: 14px 0 12px; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.book { height: 134px; min-width: 0; display: flex; flex-direction: row; color: inherit; text-decoration: none; background: white; border: 1px solid #d5e3ec; border-radius: 12px; overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.book:hover { border-color: #669fbc; box-shadow: 0 6px 20px #00669914; }
.cover { flex: 0 0 76px; min-height: 132px; background: #e8f1f7; display: grid; place-items: center; padding: 8px; }
.cover img { width: 60px; height: 112px; object-fit: contain; }
.cover-placeholder { text-align: center; color: #526e80; font-family: Georgia, serif; font-size: .7rem; line-height: 1.5; border: 1px solid #b8d0df; padding: 12px 2px; }
.book-info { flex: 1; min-width: 0; overflow: auto; padding: 12px; overflow-wrap: anywhere; }
.author { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; color: #566d7c; margin: 0 0 5px; line-height: 1.4; }
.author:empty { display: none; }
.book h2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; max-height: 4.2em; overflow: hidden; font-size: .9rem; line-height: 1.4; margin: 0; }
.subtitle { white-space: normal; font-size: .8rem; line-height: 1.4; color: #566d7c; margin: 5px 0 0; }
.empty-state { padding: 32px 0; color: #566d7c; }
@media (max-width: 520px) {
    .catalog { padding: 20px 16px 32px; }
    .toolbar { gap: 16px; }
    #search { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .book { transition: none; } }

.search-field { position: relative; }
#searchInput { padding-right: 48px; }
#searchInput::-webkit-search-cancel-button { -webkit-appearance: none; }
#clearSearch { position: absolute; inset: 0 0 0 auto; width: 44px; display: grid; place-items: center; border: 0; border-radius: 0 8px 8px 0; background: transparent; color: #006699; cursor: pointer; }
#clearSearch:hover { background: #dfedf5; }
#clearSearch:focus-visible { outline: 3px solid #006699; outline-offset: 2px; }

body.detail-open { overflow: hidden; }
#bookDialog { width: min(960px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0 24px 24px; border: 1px solid #aac5d6; border-radius: 14px; color: #203746; background: white; box-shadow: 0 20px 80px #002b4580; }
#bookDialog::backdrop { background: #102f45a6; }
.dialog-toolbar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; background: white; border-bottom: 1px solid #d5e3ec; }
.dialog-toolbar h2 { font-size: 1rem; margin: 0; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions button { width: 44px; height: 44px; border: 1px solid #aac5d6; border-radius: 8px; background: #e8f1f7; color: #006699; font-size: 1.5rem; cursor: pointer; }
.dialog-actions button:disabled { opacity: .35; cursor: default; }
.dialog-actions button:focus-visible { outline: 3px solid #006699; outline-offset: 2px; }
#detailStatus { color: #566d7c; }
.book-detail { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; padding-top: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.book-detail a { color: #006699; }
.book-detail .detail-admin { display: block; width: fit-content; margin-left: auto; font-size: .75rem; color: #6b7c87; text-align: right; text-decoration: none; }
.book-detail .detail-admin:hover { color: #006699; text-decoration: underline; }
.detail-media img { display: block; max-width: 100%; height: auto; margin: 0 auto 16px; }
.detail-toc { margin-top: 24px !important; }
.detail-text h2 { margin: 0; font-size: 1.6rem; line-height: 1.3; }
.detail-subtitle { margin-top: 8px; font-size: 1.1rem; }
.detail-authors { color: #006699; }
.detail-resume { white-space: pre-line; }
.detail-text dt { font-weight: 600; margin-top: 10px; }
.detail-text dd { margin: 0; }
.detail-citation { border-top: 1px solid #d5e3ec; padding-top: 16px; font-size: .85rem; color: #566d7c; }
@media (max-width: 600px) {
    #bookDialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); padding: 0 16px 16px; }
    .book-detail { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .detail-media { display: flex; align-items: flex-start; justify-content: center; gap: 16px; }
    .detail-media > img, .detail-media > a { max-width: 42%; }
    .detail-media img { max-height: 200px; object-fit: contain; }
    .detail-toc { margin-top: 0 !important; }
}
