/* Book Cover Search: search Open Library, pick books, then pick one cover per book in a dialog. */
.cs-search { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-search .field { flex: 1 1 240px; font-size: 15px; }
.cs-opt { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 14px; cursor: pointer; }
.cs-opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
#status { margin-top: 12px; }
#status:empty, #status[hidden] { display: none; }

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 42vw, 190px), 1fr)); gap: 12px; margin-top: 16px; padding-bottom: 88px; }
.book-card {
    position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 8px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
    color: var(--text); font: inherit; text-align: center; cursor: pointer;
    transition: border-color var(--fast);
}
.book-card:hover { border-color: var(--line-strong); }
.book-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.book-card.selected::after {
    content: "✓"; position: absolute; top: 14px; right: 14px; display: grid; place-items: center;
    width: 26px; height: 26px; background: var(--accent-soft); border: 1px solid var(--btn-line); border-radius: 50%; font-size: 14px;
}
.book-cover, .no-cover { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; margin-bottom: 6px; background: var(--card2); border-radius: var(--radius); }
.no-cover { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.book-title { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.book-author { color: var(--muted); font-size: 13px; }
.book-year { color: var(--muted); font-size: 12px; }

/* bottom bar while books are selected */
.selection-controls {
    position: fixed; left: 50%; bottom: 16px; z-index: 900; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    width: max-content; max-width: calc(100vw - 32px); padding: 10px 12px; transform: translateX(-50%);
    background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.selection-controls[hidden] { display: none; }
.selection-count { margin-right: 4px; font-size: 14px; }

/* cover browser */
.cover-dialog {
    width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: 16px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--text);
}
.cover-dialog::backdrop { background: rgba(0, 0, 0, .75); }
.modal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.modal-title { flex: 1; min-width: 0; margin: 0; font-size: 17px; }
.modal-progress { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.modal-filters { margin: 0 0 12px; }
.covers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 38vw, 170px), 1fr)); gap: 10px; }
.cover-item {
    min-width: 0; padding: 6px; background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius);
    cursor: pointer; transition: border-color var(--fast);
}
.cover-item:hover { border-color: var(--accent); }
.cover-item img { display: block; width: 100%; height: auto; border-radius: 6px; }
.cs-msg { padding: 32px 0; color: var(--muted); text-align: center; }
.modal-nav { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

.attribution { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
