.book-library-hero,
.book-catalog-grid,
.book-reader-shell,
.book-reading-guide,
.book-rights-note {
  width: min(1180px, calc(100% - 48px));
  margin-right: auto;
  margin-left: auto;
}

.book-library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.75fr);
  gap: clamp(40px, 8vw, 110px);
  align-items: center;
  min-height: min(620px, calc(100vh - 56px));
  padding: clamp(64px, 9vw, 112px) 0 clamp(52px, 8vw, 88px);
}

.book-library-copy {
  max-width: 700px;
}

.book-library-copy h1 {
  max-width: 10ch;
  margin: 0;
  color: var(--site-ink);
  font-size: clamp(3rem, 6vw, 5.8rem);
  font-weight: 800;
  line-height: 1;
  text-wrap: balance;
}

.book-library-copy > p:not(.eyebrow) {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--site-ink-soft);
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  line-height: 1.8;
}

.book-library-visual {
  width: min(100%, 480px);
  aspect-ratio: 1;
  margin: 0;
  overflow: hidden;
  background: var(--site-paper);
}

.book-library-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.book-library-status span {
  display: grid;
  grid-template-columns: minmax(80px, auto) 1fr;
  gap: 18px;
  align-items: baseline;
  min-height: 92px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--site-line);
}

.book-library-status span:last-child {
  border-bottom: 0;
}

.book-library-status strong {
  color: var(--site-teal);
  font-family: var(--site-mono);
  font-size: 1.25rem;
}

.book-library-status small {
  color: var(--site-muted);
  font-size: 0.86rem;
}

.book-catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border-top: 1px solid var(--site-line);
  border-bottom: 1px solid var(--site-line);
}

.book-catalog-card {
  display: grid;
  grid-template-rows: 420px 1fr;
  min-width: 0;
  border-right: 1px solid var(--site-line);
  background: var(--site-paper);
}

.book-catalog-card:last-child {
  border-right: 0;
}

.book-cover-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 24px;
  overflow: hidden;
  background: #e8eef2;
}

.book-cover-wrap img {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: 0 14px 30px rgba(16, 42, 67, 0.18);
}

.book-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
}

.book-card-body h2 {
  margin: 0;
  color: var(--site-ink);
  font-size: 1.4rem;
  line-height: 1.35;
}

.book-card-body p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--site-muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

.book-card-body .book-subtitle {
  color: var(--site-ink-soft);
  font-weight: 700;
}

.book-card-body .book-authors {
  color: var(--site-teal);
  font-family: var(--site-mono);
  font-size: 0.76rem;
}

.book-card-body .tool-tags {
  margin-top: auto;
  padding-top: 22px;
}

.book-open-button {
  min-width: 128px;
  min-height: 46px;
  margin-top: 18px;
  padding: 10px 18px;
  border: 1px solid var(--site-ink);
  border-radius: 3px;
  background: var(--site-ink);
  color: #ffffff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.book-open-button:hover,
.book-open-button.is-active {
  border-color: var(--site-teal);
  background: var(--site-teal);
}

.book-open-button:focus-visible,
.book-reader-toolbar button:focus-visible,
.reader-page-field input:focus-visible,
.book-reader-stage:focus-visible {
  outline: 3px solid rgba(13, 148, 136, 0.45);
  outline-offset: 3px;
}

.book-reader-shell {
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid #243b53;
  background: #102a43;
  color: #f7fbff;
}

.book-reader-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.book-reader-header h2 {
  margin: 0;
  border: 0;
  color: #ffffff;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  line-height: 1.35;
}

.book-reader-header p:not(.eyebrow) {
  margin: 8px 0 0;
  color: #bcccdc;
  font-size: 0.84rem;
}

.book-rights-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  color: #5eead4;
  font-family: var(--site-mono);
  font-size: 0.68rem;
  font-weight: 700;
}

.book-reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background: #243b53;
}

.reader-control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.book-reader-toolbar button,
.reader-page-field input {
  min-height: 44px;
  border: 1px solid #627d98;
  border-radius: 3px;
  background: #ffffff;
  color: #102a43;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

.book-reader-toolbar button {
  min-width: 72px;
  padding: 8px 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.book-reader-toolbar .reader-symbol-button {
  min-width: 44px;
  padding: 8px;
  font-family: var(--site-mono);
  font-size: 1.2rem;
}

.book-reader-toolbar button:hover:not(:disabled) {
  border-color: #2dd4bf;
  background: #e6fffb;
}

.book-reader-toolbar button:disabled,
.reader-page-field input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.reader-page-field {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: #d9e2ec;
  font-size: 0.76rem;
}

.reader-page-field input {
  width: 68px;
  padding: 6px 8px;
  text-align: center;
}

.reader-zoom-value {
  min-width: 78px;
  color: #d9e2ec;
  font-family: var(--site-mono);
  font-size: 0.74rem;
  text-align: center;
}

.book-reader-status {
  min-height: 36px;
  padding: 9px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #0b2239;
  color: #bcccdc;
  font-size: 0.78rem;
}

.book-reader-status[data-tone="success"] {
  color: #5eead4;
}

.book-reader-status[data-tone="notice"] {
  color: #fbbf24;
}

.book-reader-status[data-tone="error"] {
  color: #fecaca;
}

.book-reader-stage {
  display: grid;
  min-height: 680px;
  max-height: min(78vh, 1040px);
  place-items: start center;
  overflow: auto;
  padding: 24px;
  background: #071a2b;
  overscroll-behavior: contain;
}

.book-reader-placeholder {
  display: grid;
  gap: 10px;
  align-self: center;
  max-width: 540px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #bcccdc;
  text-align: center;
}

.book-reader-placeholder[hidden] {
  display: none;
}

.book-reader-placeholder strong {
  color: #ffffff;
  font-size: 1.1rem;
}

#book-reader-canvas {
  display: block;
  max-width: none;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  user-select: none;
  -webkit-user-select: none;
}

.book-reader-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #9fb3c8;
  font-family: var(--site-mono);
  font-size: 0.7rem;
}

.book-reading-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 52px;
  border-top: 1px solid var(--site-line);
  border-bottom: 1px solid var(--site-line);
}

.book-reading-guide > div {
  min-height: 210px;
  padding: 28px;
  border-right: 1px solid var(--site-line);
}

.book-reading-guide > div:last-child {
  border-right: 0;
}

.book-reading-guide span {
  display: block;
  margin-bottom: 28px;
  color: var(--site-orange);
  font-family: var(--site-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.book-reading-guide h3 {
  margin: 0;
  font-size: 1.15rem;
}

.book-reading-guide p {
  margin: 10px 0 0;
  color: var(--site-muted);
  font-size: 0.86rem;
  line-height: 1.75;
}

.book-rights-note {
  margin-top: 38px;
  margin-bottom: 80px;
  padding: 16px 18px;
  border-left: 3px solid var(--site-orange);
  background: #fff8ed;
  color: var(--site-ink-soft);
  font-size: 0.86rem;
  line-height: 1.75;
}

.book-rights-note strong {
  color: var(--site-orange);
}

.book-reader-shell:fullscreen {
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
}

.book-reader-shell:fullscreen .book-reader-stage {
  min-height: 0;
  max-height: none;
  height: calc(100vh - 216px);
}

@media (max-width: 900px) {
  .book-library-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .book-library-visual {
    width: min(100%, 560px);
    justify-self: center;
  }

  .book-catalog-grid {
    grid-template-columns: 1fr;
  }

  .book-catalog-card {
    grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.3fr);
    grid-template-rows: auto;
    border-right: 0;
    border-bottom: 1px solid var(--site-line);
  }

  .book-catalog-card:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .book-library-hero,
  .book-catalog-grid,
  .book-reader-shell,
  .book-reading-guide,
  .book-rights-note {
    width: 100%;
  }

  .book-library-hero {
    gap: 32px;
    padding-top: 36px;
    padding-bottom: 32px;
  }

  .book-library-copy h1 {
    max-width: none;
    font-size: clamp(2.8rem, 14vw, 4.5rem);
  }

  .book-library-copy > p:not(.eyebrow) {
    margin-top: 18px;
    font-size: 1rem;
    line-height: 1.65;
  }

  .book-library-visual {
    width: min(100%, 420px);
  }

  .book-catalog-card {
    grid-template-columns: 1fr;
    grid-template-rows: 390px auto;
  }

  .book-cover-wrap {
    padding: 20px;
  }

  .book-card-body {
    padding: 24px;
  }

  .book-reader-header,
  .book-reader-toolbar,
  .book-reader-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .book-reader-header {
    padding: 22px 20px;
  }

  .book-rights-badge {
    align-self: flex-start;
  }

  .book-reader-toolbar {
    gap: 12px;
    padding: 12px;
  }

  .reader-control-group {
    width: 100%;
  }

  .reader-control-group > button:not(.reader-symbol-button),
  .reader-page-field {
    flex: 1 1 auto;
  }

  .reader-page-field {
    justify-content: center;
  }

  .book-reader-stage {
    min-height: 520px;
    max-height: 72vh;
    padding: 12px;
  }

  .book-reader-placeholder {
    padding: 24px 18px;
  }

  .book-reading-guide {
    grid-template-columns: 1fr;
  }

  .book-reading-guide > div {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--site-line);
  }

  .book-reading-guide > div:last-child {
    border-bottom: 0;
  }
}

@media print {
  .book-reader-shell {
    display: none !important;
  }
}
