:root {
  color-scheme: dark;
  --ink: #080d16;
  --paper: #f5f0e5;
  --gold: #e4bd69;
  --muted: #bfc8d4;
  --line: rgba(228, 189, 105, .42);
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; }
body {
  margin: 0;
  color: #f7f3e9;
  background: radial-gradient(ellipse at 50% 0%, rgba(26,50,75,.75), transparent 52rem), linear-gradient(180deg,#0b1523,#070c14 64rem);
  font-family: Georgia, 'Times New Roman', serif;
}
a { color: inherit; }
.reader-header {
  min-height: 68px;
  padding: .75rem clamp(1rem,4vw,3.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--gold); font-size: 1rem; text-decoration: none; font-variant: small-caps; }
.reader-header nav { display: flex; gap: clamp(1rem,4vw,2.5rem); }
.reader-header nav a { text-decoration: none; font: 600 .92rem/1.2 system-ui,sans-serif; }
.reader-header nav a:hover,.reader-header nav a:focus-visible { color: var(--gold); }
main { width: min(1160px,calc(100% - 2rem)); margin: 0 auto; }
.book-intro {
  min-height: 690px;
  padding: clamp(2.5rem,6vw,5rem) 0 3.5rem;
  display: grid;
  grid-template-columns: minmax(250px,.8fr) minmax(380px,1.2fr);
  align-items: center;
  gap: clamp(2rem,6vw,5rem);
  border-bottom: 1px solid var(--line);
}
.intro-copy { max-width: 470px; }
.eyebrow { margin: 0 0 .8rem; color: var(--gold); font: 700 .72rem/1.4 system-ui,sans-serif; letter-spacing: .16em; text-transform: uppercase; }
h1,h2,p,figure { margin-top: 0; }
h1 { margin-bottom: 1rem; color: #fff; font-size: clamp(2.25rem,5vw,4.2rem); line-height: 1.04; font-weight: 500; }
.subtitle { max-width: 33rem; margin-bottom: 1.5rem; color: #e8e3d8; font-size: clamp(1.05rem,2vw,1.35rem); line-height: 1.55; }
.byline { color: var(--muted); font: 500 .95rem/1.6 system-ui,sans-serif; }
.cover-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: clamp(.8rem,2vw,1.5rem); }
.cover-pair figure { margin: 0; min-width: 0; }
.cover-zoom {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: #050910;
  cursor: zoom-in;
}
.cover-zoom img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border: 1px solid rgba(228,189,105,.48);
  box-shadow: 0 24px 55px rgba(0,0,0,.38);
}
.cover-zoom:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.zoom-indicator {
  position: absolute;
  right: .55rem;
  bottom: .55rem;
  padding: .42rem .55rem;
  color: #fff8e8;
  background: rgba(5,9,16,.84);
  border: 1px solid rgba(228,189,105,.5);
  font: 600 .7rem/1 system-ui,sans-serif;
  opacity: 0;
  transition: opacity .18s ease;
}
.cover-zoom:hover .zoom-indicator,.cover-zoom:focus-visible .zoom-indicator { opacity: 1; }
.cover-pair figcaption { margin-top: .65rem; color: var(--muted); font: 500 .78rem/1.4 system-ui,sans-serif; text-align: center; }
.book-description {
  max-width: 850px;
  margin: 0 auto;
  padding: clamp(2.5rem,6vw,4.5rem) 0;
  border-bottom: 1px solid var(--line);
  color: #e9e4da;
  font-size: 1.08rem;
  line-height: 1.82;
}
.book-description h2 { margin: 0 0 .45rem; color: #fff; font-size: clamp(1.55rem,3vw,2rem); line-height: 1.25; }
.book-description p { margin-bottom: 1.15rem; }
.book-description .description-subtitle { margin-bottom: 2rem; color: var(--gold); font-size: 1.08rem; }
.book-description .description-lead { color: #fff; font-size: 1.23rem; line-height: 1.65; }
.book-description .description-emphasis { margin-top: 2rem; color: var(--gold); font-size: 1.19rem; }
.book-description .description-question { padding-left: 1rem; border-left: 2px solid var(--gold); color: #fff; font-size: 1.18rem; }
.book-description .description-byline { margin: 2rem 0 0; color: var(--muted); font: 600 .9rem/1.5 system-ui,sans-serif; }
.cover-dialog {
  width: min(94vw, 1050px);
  height: min(94svh, 1450px);
  max-width: none;
  max-height: none;
  padding: 3.4rem 1rem 1rem;
  overflow: hidden;
  border: 1px solid rgba(228,189,105,.62);
  color: #fff;
  background: rgba(5,9,16,.97);
  box-shadow: 0 32px 100px rgba(0,0,0,.72);
}
.cover-dialog::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(5px); }
.cover-dialog img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cover-dialog form { position: absolute; top: .65rem; right: .65rem; }
.cover-dialog-close { min-height: 42px; padding: .55rem .9rem; border: 1px solid var(--line); color: #fff8e8; background: #101c2b; font: 600 .85rem/1 system-ui,sans-serif; cursor: pointer; }
.reader-section { padding: clamp(2.5rem,6vw,4.5rem) 0 5rem; }
.reader-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.reader-heading-row h2 { margin-bottom: 0; font-size: clamp(1.8rem,3vw,2.6rem); font-weight: 500; }
#reader-status { max-width: 28rem; margin: 0 0 .2rem; color: var(--muted); font: .9rem/1.5 system-ui,sans-serif; text-align: right; }
.reader-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.reader-toolbar button {
  min-height: 44px;
  width: fit-content;
  padding: .65rem 1rem;
  border: 1px solid rgba(228,189,105,.48);
  border-radius: 4px;
  color: #fff8e8;
  background: rgba(228,189,105,.08);
  font: 600 .9rem/1 system-ui,sans-serif;
  cursor: pointer;
}
.reader-toolbar button:last-child { justify-self: end; }
.reader-toolbar button:hover:not(:disabled),.reader-toolbar button:focus-visible { background: rgba(228,189,105,.18); }
.reader-toolbar button:disabled { opacity: .45; cursor: not-allowed; }
.page-jump { display: flex; align-items: center; gap: .5rem; color: var(--muted); font: .85rem/1 system-ui,sans-serif; }
.page-jump input { width: 4.5rem; min-height: 40px; border: 1px solid rgba(255,255,255,.28); border-radius: 4px; color: white; background: #101c2b; text-align: center; font: inherit; }
.book-viewport {
  width: min(100%,1040px,104svh) !important;
  height: auto;
  aspect-ratio: 4 / 3;
  min-height: 0;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(228,189,105,.22);
  background: radial-gradient(ellipse at 50% 50%,#182434 0,#101925 48%,#0b111b 100%);
  box-shadow: 0 32px 80px rgba(0,0,0,.32);
}
#book-pages { width: 100%; height: 100%; }
.page { overflow: hidden; color: #1d1c19; background: var(--paper); }
.page canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.page-cover { background: #090e17; }
.page-cover img { display: block; width: 100%; height: 100%; object-fit: fill; }
.reader-hint { margin: .9rem 0 0; color: var(--muted); font: .82rem/1.5 system-ui,sans-serif; text-align: center; }
footer { min-height: 68px; padding: 1rem clamp(1rem,4vw,3.5rem); display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); color: var(--muted); font: .76rem/1.4 system-ui,sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }
@media (max-width: 760px) {
  .book-intro { min-height: 0; grid-template-columns: 1fr; gap: 2rem; }
  .intro-copy { max-width: none; }
  .cover-pair { max-width: 620px; margin: 0 auto; }
  .reader-heading-row { align-items: start; flex-direction: column; gap: .75rem; }
  #reader-status { text-align: left; }
}
@media (max-width: 600px) {
  .book-viewport { width: min(100%,46.67svh) !important; height: auto; aspect-ratio: 2 / 3; min-height: 0; }
  .book-viewport .stf__wrapper {
    transform: none !important;
  }
}
@media (max-width: 420px) {
  .reader-header { min-height: 60px; }
  .reader-header nav { gap: 1rem; }
  .cover-pair { gap: .55rem; }
  .reader-toolbar { grid-template-columns: 1fr auto 1fr; gap: .35rem; }
  .reader-toolbar button { min-height: 42px; padding: .55rem .6rem; font-size: .78rem; }
  .page-jump { gap: .3rem; font-size: .75rem; }
  .page-jump input { width: 3.5rem; }
  footer { flex-direction: column; }
}
@media (max-width: 600px) {
  .reader-header { height: auto; min-height: 0; flex-wrap: wrap; row-gap: .65rem; }
  .reader-header .brand { order: 1; }
  .reader-header .site-language-control { order: 2; flex: 0 0 auto; margin-left: auto; }
  .reader-header nav { order: 3; flex: 1 0 100%; justify-content: flex-end; padding-bottom: .25rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }