.book-library { width: min(90%, 72rem); margin: 0 auto; padding: clamp(1.8rem, 5vw, 4rem) 0 4.5rem; }
.book-library [hidden] { display: none !important; }
.book-library h1, .book-library h2 { margin: 0; color: var(--ink); font-family: var(--serif); font-weight: 400; line-height: 1.05; }
.book-library h1 { font-size: clamp(3rem, 7vw, 5.6rem); }
.book-intro { max-width: 40rem; margin: .6rem 0 1.8rem; color: var(--muted); font-size: 1.1rem; }
.shelf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.shelf-book { display: grid; grid-template-columns: minmax(5rem, .85fr) 1.2fr; align-items: center; gap: clamp(1rem, 2.5vw, 2rem); padding: clamp(1.1rem, 2vw, 2rem); background: #ecf0e9; border: 1px solid #b9c7be; border-radius: .35rem; }
.shelf-book:nth-child(2) { background: #e5eef2; border-color: #abc2d0; }
.shelf-book img { display: block; width: 100%; height: auto; box-shadow: 0 .4rem 1.2rem #223d4824; }
.shelf-book h2 { font-size: clamp(1.8rem, 3.2vw, 3rem); }
.shelf-book p { line-height: 1.45; margin: .8rem 0; }
.book-open, .book-controls button, .book-controls select {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border: 1px solid #345663; border-radius: .3rem; padding: .5rem .95rem; font: 600 1rem/1.25 var(--sans);
}
.book-open { background: #284855; color: #fff; text-decoration: none; }
.book-open:hover { background: #163743; }
.book-back { display: inline-block; color: #21556c; text-decoration: underline; text-underline-offset: .2rem; margin-bottom: 1.2rem; }
.book-credit { margin: 1.25rem 0 0; color: var(--muted); }
.book-credit a, .source-book a { text-decoration: underline; text-underline-offset: .2rem; }
.book-reading { width: min(100%, 56rem); margin: auto; }
.book-reading h2, .source-book h2 { font-size: clamp(2.2rem, 5vw, 3.7rem); }
.book-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; padding-block: .8rem; border-block: 1px solid var(--line); margin-block: 1.1rem; }
.book-controls button, .book-controls select { background: #fffdf7; color: #193945; cursor: pointer; }
.book-controls button:hover:not(:disabled), .book-controls select:hover { background: #e4efef; }
.book-controls button:disabled { color: #66747a; border-color: #aab5b7; background: #eef0ec; cursor: default; }
.book-controls label { display: flex; align-items: center; gap: .4rem; }
.book-controls select { padding-inline: .5rem; }
.book-library :focus-visible { outline: 3px solid #26657f; outline-offset: 3px; }
.book-art { margin: .6rem 0; padding: clamp(.25rem, 1.4vw, 1rem); background: #e5ece9; border-radius: .3rem; text-align: center; }
.book-art img { display: block; margin: auto; max-width: 100%; width: auto; max-height: 78vh; max-height: 78svh; height: auto; }
.book-spread {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: ". progress ." "previous page next";
  align-items: center;
  gap: .4rem clamp(.5rem, 1.6vw, 1.2rem);
}
.reader-progress { grid-area: progress; margin: 0; text-align: center; font-size: 1rem; color: var(--muted); }
#book-page { grid-area: page; min-width: 0; }
#previous-page { grid-area: previous; }
#next-page { grid-area: next; }
.page-arrow {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid #805f22;
  border-radius: 50%;
  background: #e5b34c;
  color: #192e36;
  cursor: pointer;
}
.page-arrow svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-arrow:hover:not(:disabled) { background: #f4ce78; }
.page-arrow:disabled { color: #657277; border-color: #b6c2c3; background: #e9eeec; cursor: default; }
@media (max-width: 640px) {
  .book-spread { grid-template-areas: "previous progress next" "page page page"; }
}
.book-words, .source-page { white-space: pre-line; overflow-wrap: anywhere; }
.book-words { max-width: 38rem; margin: 1rem auto; padding: clamp(.8rem, 4vw, 2.8rem); background: #fffcf7; font-family: Georgia, serif; font-size: clamp(1.3rem, 3vw, 1.8rem); line-height: 1.65; }
.source-book:not(:target) { display: none; }
.source-book { margin-top: 2rem; }
.source-page { padding: .8rem; max-width: 44rem; }
@media (max-width: 800px) { .shelf-grid { grid-template-columns: minmax(0, 1fr); } .shelf-book { grid-template-columns: minmax(6rem, .6fr) 1.3fr; } }
@media (max-width: 450px) { .book-library { width: 92%; } .shelf-book { gap: .85rem; padding: .8rem; } .book-controls { gap: .5rem; } .book-controls button { padding-inline: .7rem; } }
