.book-viewer-page {
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: #292c24;
  color: var(--soft-white);
}

.book-viewer-header {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  padding: 0 clamp(1rem, 3vw, 3rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(41, 44, 36, 0.96);
}

.book-viewer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  width: max-content;
  color: var(--soft-white);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.book-viewer-brand img { border-radius: 50%; }
.book-viewer-title {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  text-align: center;
}

.book-viewer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.25rem;
}

.book-viewer-text-link,
.book-viewer-download {
  color: var(--soft-white);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-viewer-text-link { opacity: 0.72; }
.book-viewer-text-link:hover { opacity: 1; }
.book-viewer-download {
  padding: 0.65rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
}
.book-viewer-download:hover { background: var(--soft-white); color: var(--olive-black); }

.book-viewer {
  height: calc(100vh - 72px);
  height: calc(100svh - 72px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.book-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(42px, 6vw, 76px) minmax(0, 1fr) clamp(42px, 6vw, 76px);
  align-items: center;
  gap: clamp(0.5rem, 2vw, 1.5rem);
  padding: clamp(1rem, 2.4vh, 2rem) clamp(0.5rem, 2vw, 1.5rem);
}

.book-pages {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
}

.book-page {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  visibility: hidden;
  opacity: 0;
  transform: translateX(18px) scale(0.985);
  transition: opacity 280ms ease, transform 360ms ease, visibility 0s linear 360ms;
}

.book-page.is-active {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}

.book-page.is-leaving-back { transform: translateX(18px) scale(0.985); }
.book-page.is-entering-back { transform: translateX(-18px) scale(0.985); }

.book-page img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-user-drag: none;
}

.book-page.is-cover img { box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38); }

.book-nav {
  width: clamp(42px, 5vw, 60px);
  height: clamp(42px, 5vw, 60px);
  display: grid;
  place-items: center;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: transparent;
  color: var(--soft-white);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, opacity 180ms ease;
}
.book-nav span { font-size: 1.2rem; line-height: 1; }
.book-nav:hover:not(:disabled) { background: var(--soft-white); color: var(--olive-black); }
.book-nav:disabled { opacity: 0.2; cursor: default; }

.book-viewer-footer {
  display: grid;
  grid-template-columns: minmax(8rem, auto) minmax(8rem, 24rem) minmax(8rem, auto);
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3vw, 3rem);
  padding: 0.75rem clamp(1rem, 3vw, 3rem) 1.15rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.book-status { margin: 0; color: rgba(255, 255, 255, 0.78); }
.book-status-divider { margin: 0 0.35rem; opacity: 0.4; }
.book-progress { height: 1px; background: rgba(255, 255, 255, 0.2); }
.book-progress span { display: block; width: 7.14%; height: 100%; background: var(--soft-white); transition: width 280ms ease; }
.book-hint { margin: 0; color: rgba(255, 255, 255, 0.48); text-align: right; }
.book-noscript { padding: 1rem; text-align: center; background: #292c24; color: white; }
.book-noscript a { color: inherit; text-decoration: underline; }

@media (max-width: 800px) {
  .book-viewer-header {
    height: 62px;
    grid-template-columns: 1fr auto;
  }
  .book-viewer { height: calc(100svh - 62px); }
  .book-viewer-title,
  .book-viewer-text-link { display: none; }
  .book-viewer-download { padding: 0.55rem 0.8rem; font-size: 0.64rem; }
  .book-stage {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 0.75rem 0.75rem 0;
  }
  .book-pages { grid-column: 1; grid-row: 1; }
  .book-nav {
    position: fixed;
    bottom: 2.9rem;
    z-index: 2;
    width: 42px;
    height: 42px;
  }
  .book-nav--previous { left: 1rem; }
  .book-nav--next { right: 1rem; }
  .book-viewer-footer {
    min-height: 68px;
    grid-template-columns: 1fr;
    padding: 0.65rem 4.5rem 0.8rem;
  }
  .book-status { text-align: center; }
  .book-progress { width: min(52vw, 15rem); margin: 0 auto; }
  .book-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .book-page,
  .book-progress span { transition: none; }
}
