/* reading — domain styles; order is declared in index.html. */
.reading-room-modal { width: min(1380px, 100%); height: min(92dvh, 920px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #f4efe5; box-shadow: var(--shadow-lg); }
.reading-room-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 24px; border-bottom: 1px solid rgba(102, 82, 54, .14); background: rgba(255, 252, 244, .92); }
.reading-room-header h2, .reading-room-header p { margin: 0; }
.reading-room-header h2 { font-family: Georgia, "Songti SC", serif; font-size: 1.5rem; }
.reading-header-actions, .reader-toolbar, .reader-settings, .book-card-actions { display: flex; align-items: center; gap: 8px; }
.bookshelf-panel, .notes-panel { min-height: 0; flex: 1; overflow: auto; padding: 24px; }
.bookshelf-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 150px 125px 140px auto auto; gap: 10px; margin-bottom: 12px; }
.bookshelf-toolbar select, .reading-search { height: 42px; border: 1px solid rgba(102, 82, 54, .2); border-radius: 10px; background: rgba(255, 253, 248, .9); color: var(--text); }
.bookshelf-toolbar select { padding: 0 10px; }
.reading-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.reading-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; }
.reading-status { min-height: 28px; color: #786b57; font-size: 0.75rem; }
.bookshelf-grid { display: grid; gap: 22px; }
.shelf-group h3 { margin: 0 0 14px; color: #675a47; font: 600 1rem Georgia, "Songti SC", serif; }
.shelf-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 24px; align-items: start; }
.shelf-book-card { min-width: 0; }
.book-cover { position: relative; width: 100%; aspect-ratio: 3 / 4.15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; overflow: hidden; padding: 24px 16px 14px; border: 0; border-radius: 4px 12px 12px 4px; background: linear-gradient(145deg, #7d392f, #b3634f); color: #fff8e7; box-shadow: -5px 5px 0 rgba(81, 55, 34, .12), 0 12px 22px rgba(60, 42, 28, .18); cursor: pointer; text-align: center; transition: transform .18s ease, box-shadow .18s ease; }
.shelf-book-card:nth-child(6n+2) .book-cover { background: linear-gradient(145deg, #3f5e59, #67877d); }
.shelf-book-card:nth-child(6n+3) .book-cover { background: linear-gradient(145deg, #4c4b6b, #7f789a); }
.shelf-book-card:nth-child(6n+4) .book-cover { background: linear-gradient(145deg, #9a6b32, #c79a57); }
.shelf-book-card:nth-child(6n+5) .book-cover { background: linear-gradient(145deg, #375b75, #638aa2); }
.shelf-book-card:nth-child(6n+6) .book-cover { background: linear-gradient(145deg, #67503b, #96795d); }
.book-cover::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(255, 244, 213, .34); border-radius: 2px 8px 8px 2px; pointer-events: none; }
.book-cover:hover { transform: translateY(-4px); box-shadow: -5px 7px 0 rgba(81, 55, 34, .12), 0 17px 28px rgba(60, 42, 28, .23); }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-cover > strong { position: relative; z-index: 1; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; font-family: Georgia, "Songti SC", serif; font-size: 1.0625rem; line-height: 1.55; letter-spacing: .08em; }
.book-cover-ornament { position: relative; z-index: 1; padding: 4px 9px; border: 1px solid rgba(255, 248, 225, .45); font-size: 0.5625rem; letter-spacing: .3em; }
.book-progress { position: absolute; z-index: 2; right: 10px; bottom: 9px; left: 10px; height: 3px; overflow: hidden; border-radius: 3px; background: rgba(255, 255, 255, .25); }
.book-progress i { display: block; height: 100%; background: #fff1bd; }
.book-card-info { padding: 12px 2px 0; }
.book-card-info > strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; }
.book-card-info small { display: block; overflow: hidden; margin: 4px 0 8px; color: #7e7464; text-overflow: ellipsis; white-space: nowrap; font-size: 0.625rem; }
.book-mini-action { width: 30px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(102, 82, 54, .2); border-radius: 7px; background: rgba(255, 253, 248, .75); color: #7d715e; cursor: pointer; }
.book-mini-action.active { border-color: #ac665b; background: #f7dfd8; color: #9c3d35; }
.book-mini-action svg { width: 14px; height: 14px; }
.reader-panel { position: relative; min-height: 0; flex: 1; display: flex; flex-direction: column; background: #f4efe5; }
.reader-toolbar, .reader-settings { flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid rgba(102, 82, 54, .14); background: rgba(255, 252, 244, .85); }
.reader-toolbar > strong { min-width: 180px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.reader-toolbar > span { color: #7e7464; font-size: 0.6875rem; }
.reader-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; position: relative; }
.reader-toc { overflow: auto; padding: 16px 10px; border-right: 1px solid rgba(102, 82, 54, .14); background: rgba(235, 226, 209, .68); }
.reader-toc button { width: 100%; display: block; overflow: hidden; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: #5d5549; cursor: pointer; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.reader-toc button.active { background: rgba(255, 252, 244, .95); color: #823e35; font-weight: 700; }
.reader-content { --reader-font-size: 18px; --reader-line-height: 2; width: min(820px, calc(100% - 40px)); min-height: 0; overflow: auto; margin: 0 auto; padding: 42px 54px 90px; outline: 0; color: #3c372f; font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif; font-size: var(--reader-font-size); line-height: var(--reader-line-height); }
.reader-content h1 { margin: 0 0 32px; font-size: 1.55em; text-align: center; }
.reader-content p { margin: 0 0 1.45em; text-align: justify; text-indent: 2em; white-space: pre-wrap; }
.reader-content.horizontal { column-width: min(680px, calc(100vw - 330px)); column-gap: 90px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; }
.reader-content.horizontal > * { break-inside: avoid; scroll-snap-align: start; }
.reading-mark { padding: 0 .08em; border-radius: 2px; background: #f7df73; color: inherit; }
.reading-mark.green { background: #bfe5b9; }
.reading-mark.blue { background: #bcdfee; }
.reading-mark.pink { background: #efc4cf; }
.reader-content.local-pdf-mode { width: 100%; padding: 0; }
.local-pdf-frame { width: 100%; height: 100%; min-height: 520px; border: 0; background: #fff; }
.reader-panel.night { background: #191b1d; }
.reader-panel.night .reader-toolbar, .reader-panel.night .reader-settings { border-color: #33383d; background: #22262a; color: #e7e1d6; }
.reader-panel.night .reader-content { color: #d7d1c5; }
.reader-panel.night .reader-toc { border-color: #33383d; background: #1e2124; }
.reader-panel.night .reader-toc button { color: #aba79f; }
.reader-panel.night .reader-toc button.active { background: #30353a; color: #f1dfb7; }
.reader-search-panel { padding: 10px 16px; border-bottom: 1px solid rgba(102, 82, 54, .14); background: rgba(255, 252, 244, .92); }
.reader-search-panel form { display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
.reader-search-panel input { min-width: 0; flex: 1; height: 38px; padding: 0 10px; border: 1px solid rgba(102, 82, 54, .2); border-radius: 8px; background: #fffdf8; color: var(--text); }
.reader-search-results { display: grid; gap: 6px; max-height: 180px; overflow: auto; max-width: 720px; margin: 8px auto 0; color: #756a5a; font-size: 0.75rem; }
.reader-search-summary { margin: 0; }
.reader-search-result { display: grid; gap: 3px; padding: 8px 10px; border: 1px solid rgba(102, 82, 54, .12); border-radius: 7px; background: rgba(255, 253, 248, .8); color: #51483d; cursor: pointer; text-align: left; }
.reader-search-result:hover { border-color: #b98b51; background: #fffaf0; }
.reader-search-result span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-search-result mark { background: #f7df73; color: inherit; }
.reader-chat-panel { min-width: 0; display: flex; flex-direction: column; border-left: 1px solid rgba(102, 82, 54, .14); background: rgba(255, 252, 244, .8); }
.reader-chat-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid rgba(102, 82, 54, .14); }
.reader-chat-messages { min-height: 0; flex: 1; overflow: auto; padding: 12px; }
.reader-chat-message { margin-bottom: 10px; }
.reader-chat-message p { margin: 0; padding: 9px 10px; border-radius: 8px; background: #fffdf8; color: #4a4238; font-size: 0.8125rem; line-height: 1.55; white-space: pre-wrap; }
.reader-chat-message.user p { background: #eee3ce; }
.reader-citations { display: grid; gap: 4px; margin-top: 5px; }
.reader-citations button { padding: 0; border: 0; background: transparent; color: #8b5b32; cursor: pointer; font-size: 0.6875rem; text-align: left; }
.reader-citations button:hover { text-decoration: underline; }
.reader-chat-form { display: grid; gap: 7px; padding: 10px; border-top: 1px solid rgba(102, 82, 54, .14); }
.reader-chat-form textarea { resize: vertical; min-height: 58px; padding: 8px; border: 1px solid rgba(102, 82, 54, .2); border-radius: 7px; background: #fffdf8; color: var(--text); font: inherit; }
.reader-selection-popover { position: absolute; z-index: 8; width: min(300px, calc(100% - 20px)); padding: 10px; border: 1px solid rgba(102, 82, 54, .2); border-radius: 9px; background: #fffdf8; box-shadow: var(--shadow-lg); }
.reader-selection-popover textarea { width: 100%; resize: vertical; min-height: 62px; margin: 8px 0; padding: 8px; border: 1px solid rgba(102, 82, 54, .18); border-radius: 7px; background: #fff; color: var(--text); font: inherit; }
.reader-selection-popover > div:last-child { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.reader-note-colors { display: flex; gap: 7px; }
.reader-note-colors button { width: 22px; height: 22px; padding: 0; border: 2px solid transparent; border-radius: 50%; cursor: pointer; }
.reader-note-colors button[data-note-color="yellow"] { background: #f7df73; }
.reader-note-colors button[data-note-color="green"] { background: #bfe5b9; }
.reader-note-colors button[data-note-color="blue"] { background: #bcdfee; }
.reader-note-colors button.active { border-color: #4a4238; }
.reader-settings { justify-content: center; border-top: 1px solid rgba(102, 82, 54, .14); border-bottom: 0; }
.reader-settings label { display: flex; align-items: center; gap: 5px; font-size: 0.6875rem; }
.reading-notes-list { display: grid; gap: 12px; max-width: 900px; margin: 12px auto; }
.reading-note-card { padding: 16px; border: 1px solid rgba(102, 82, 54, .16); border-radius: 12px; background: rgba(255, 253, 248, .9); }
.reading-note-card blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid #d8a947; background: #fff4c9; color: #554a38; }
.reading-note-card p { color: #726655; }

@media (max-width: 820px) {
    .reading-room-modal { width: 100%; height: 96dvh; border-radius: 18px 18px 0 0; }
    .bookshelf-toolbar { grid-template-columns: 1fr 1fr; }
    .reading-search { grid-column: 1 / -1; }
    .shelf-group-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 22px 16px; }
    .reader-layout { grid-template-columns: 1fr; }
    .reader-toc { max-height: 100px; display: flex; gap: 5px; border-right: 0; border-bottom: 1px solid rgba(102, 82, 54, .14); }
    .reader-toc button { min-width: 130px; width: auto; }
    .reader-content { width: 100%; padding: 28px 22px 72px; }
    .reader-chat-panel { min-height: 260px; border-top: 1px solid rgba(102, 82, 54, .14); border-left: 0; }
}

