:root {
  color-scheme: light;
  --navy: #10252c;
  --navy-soft: #1c343b;
  --ink: #24343a;
  --muted: #718087;
  --gold: #c5a66d;
  --paper: #f8f5ec;
  --line: rgba(224, 218, 202, .78);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #edf0ec; }
body {
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(ellipse at 50% 43%, rgba(255,255,255,.94) 0, rgba(248,248,243,.9) 33%, rgba(233,237,233,.96) 75%),
    #edf0ec;
  overflow-x: hidden;
}
button, summary, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
.app-shell { min-height: 100svh; display: flex; flex-direction: column; }
.topbar {
  min-height: 76px; padding: 12px clamp(18px, 4vw, 64px); display: flex;
  align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(16,37,44,.08);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--navy); }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid #bd9b5b; border-radius: 50%; color: #9d7d45; font: 600 12px Georgia, serif; letter-spacing: .05em; }
.brand-copy { display: grid; gap: 4px; }
.brand-copy strong { font-size: 12px; letter-spacing: .19em; }
.brand-copy small { color: #748187; font-size: 8px; letter-spacing: .17em; }
.edition { margin: 0; color: #758188; font-size: 10px; letter-spacing: .13em; }
.edition span { padding: 0 5px; color: var(--gold); }
.reader { width: min(100%, 1540px); margin: 0 auto; padding: 27px clamp(12px, 3vw, 46px) 15px; flex: 1; display: flex; flex-direction: column; }
.reader-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 0 clamp(0px, 1vw, 18px) 15px; }
.eyebrow { margin: 0 0 6px; color: #927b53; font-size: 9px; font-weight: 650; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0; color: var(--navy); font: 400 clamp(20px, 2vw, 29px)/1.2 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
.contents { position: relative; z-index: 8; flex: 0 0 auto; }
.contents summary { list-style: none; cursor: pointer; color: #516067; border: 1px solid #d6dbd7; background: rgba(255,255,255,.63); border-radius: 24px; padding: 10px 15px; font-size: 11px; letter-spacing: .04em; }
.contents summary::-webkit-details-marker { display:none; }
.contents summary span { margin-left: 8px; color: #9a845a; }
#contents-list { position: absolute; right: 0; top: calc(100% + 8px); width: min(355px, calc(100vw - 34px)); max-height: min(65vh, 560px); overflow: auto; padding: 12px; border: 1px solid #dce0dc; border-radius: 14px; background: rgba(251,251,247,.98); box-shadow: 0 20px 55px rgba(16,37,44,.18); }
.contents-group { border-bottom: 1px solid #e6e8e2; }
.contents-group:last-child { border: 0; }
.contents-group summary { border: 0; border-radius: 6px; background: transparent; padding: 11px 8px; color: var(--navy); font-weight: 650; }
.contents-group ul { list-style: none; margin: 0; padding: 0 4px 8px; }
.contents-group a { display: block; padding: 7px 8px; color: #5d6b70; text-decoration: none; font-size: 11px; line-height: 1.35; border-radius: 5px; }
.contents-group a:hover, .contents-group a:focus-visible { color: var(--navy); background: #f0eee6; outline: none; }
.book-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 2px 0 7px; perspective: 1800px; }
.book-frame { position: relative; width: min(100%, 1240px); height: min(74svh, 930px); min-height: 0; display: grid; place-items: center; }
#book { position: relative; z-index: 1; margin: 0 auto; }
#book .stf__parent { margin: 0 auto; }
.sharp-page-overlay { position: absolute; z-index: 2; display: flex; overflow: hidden; pointer-events: none; }
.sharp-page-overlay[hidden] { display: none !important; }
.sharp-page-overlay .sharp-page { position: relative; display: block; flex: 0 0 auto; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.sharp-page-overlay[data-layout="double"]::after { content: ""; position: absolute; z-index: 1; top: 0; bottom: 0; left: calc(50% - 9px); width: 18px; background: linear-gradient(90deg, transparent, rgba(24,31,29,.13) 46%, rgba(24,31,29,.1) 54%, transparent); }
.book-edge { position: absolute; z-index: 0; width: min(95%, 1210px); height: 14px; bottom: -3px; border-radius: 50%; background: rgba(17,31,34,.42); filter: blur(18px); transform: scaleY(.55); pointer-events: none; }
.reader-controls { min-height: 45px; display: flex; align-items: center; justify-content: center; gap: 11px; }
.control-button { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #d7ddd9; border-radius: 22px; color: #304249; background: rgba(255,255,255,.68); cursor: pointer; transition: background .18s, border-color .18s, transform .18s; }
.control-button:hover { background: white; border-color: #b9c5c1; transform: translateY(-1px); }
.control-button:focus-visible, .contents summary:focus-visible { outline: 2px solid #a8874e; outline-offset: 3px; }
.arrow-button { font-size: 21px; line-height: 1; }
.page-status { min-width: 186px; display: flex; align-items: center; justify-content: center; gap: 11px; color: #46565d; font-size: 11px; font-variant-numeric: tabular-nums; }
.status-divider { width: 1px; height: 15px; background: #cfd5d1; }
#reading-mode { color: #879196; font-size: 10px; }
.fullscreen-button { padding: 0 13px; font-size: 17px; }
.button-label { font-size: 10px; letter-spacing: .02em; }
.zoom-button { display: none; }
.zoom-dialog { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: var(--ink); background: #f2f3ef; }
.zoom-dialog::backdrop { background: rgba(9,24,29,.82); }
.zoom-toolbar { position: sticky; z-index: 2; top: 0; min-height: 48px; padding: 6px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid #dce0db; background: rgba(250,250,246,.97); color: #4a5a60; font-size: 11px; letter-spacing: .03em; }
.zoom-actions { display: flex; align-items: center; gap: 5px; }
.zoom-scale { min-width: 39px; text-align: center; color: #526168; font-size: 10px; font-variant-numeric: tabular-nums; }
.zoom-toolbar button { min-width: 35px; min-height: 36px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid #d6dcd8; border-radius: 19px; background: white; color: var(--navy); font-size: 12px; }
.zoom-toolbar button:disabled { opacity: .42; }
.zoom-toolbar button:focus-visible { outline: 2px solid #a8874e; outline-offset: 2px; }
.zoom-toolbar button span { font-size: 20px; line-height: .8; }
.zoom-scroll { height: calc(100dvh - 80px); overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; }
.zoom-surface { width: max-content; min-width: 100%; min-height: 100%; touch-action: none; }
.zoom-surface canvas, .zoom-surface img { display: block; max-width: none; margin: 0; background: white; transform-origin: 0 0; will-change: transform; }
.zoom-page-nav { position: absolute; z-index: 4; right: 8px; bottom: 10px; left: 8px; display: flex; justify-content: space-between; pointer-events: none; }
.zoom-page-nav button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(16,37,44,.18); border-radius: 50%; background: rgba(250,250,246,.72); box-shadow: 0 3px 14px rgba(16,37,44,.12); color: var(--navy); font: 400 28px/1 Georgia, serif; cursor: pointer; pointer-events: auto; touch-action: manipulation; }
.zoom-page-nav button:hover, .zoom-page-nav button:focus-visible { background: rgba(250,250,246,.96); }
.zoom-page-nav button:disabled { opacity: .34; cursor: default; }
.zoom-page-nav button:focus-visible { outline: 2px solid #a8874e; outline-offset: 3px; }
.zoom-hint { margin: 0; min-height: 27px; padding: 6px; text-align: center; color: #879196; font-size: 9px; }
.zoom-dialog.direct-pinch { overflow: hidden; background: transparent; }
.zoom-dialog.direct-pinch::backdrop { background: transparent; }
.zoom-dialog.direct-pinch .zoom-toolbar, .zoom-dialog.direct-pinch .zoom-hint { display: none; }
.zoom-dialog.direct-pinch .zoom-scroll { height: 100%; width: 100%; overscroll-behavior: none; touch-action: none; }
.zoom-dialog.direct-pinch .zoom-surface { min-width: 100%; min-height: 100%; }
.reader-hint, .fallback-link, .reader-error { margin: 6px 0 0; text-align: center; color: #899397; font-size: 10px; line-height: 1.5; }
.fallback-link a { color: #69777c; text-decoration-color: #b7a275; text-underline-offset: 3px; }
.reader-error { color: #8c4a3a; }
.footer { min-height: 37px; padding: 9px clamp(18px, 4vw, 64px); border-top: 1px solid rgba(16,37,44,.07); display: flex; align-items: center; justify-content: space-between; color: #94a0a2; font-size: 8px; letter-spacing: .16em; }
.reader.is-fullscreen { position: fixed; inset: 0; z-index: 50; width: 100vw; max-width: none; padding: 15px clamp(12px,2vw,30px); background: radial-gradient(ellipse at 50% 45%, #fff 0, #eff1ec 73%); }
.reader.is-fullscreen .book-frame { height: min(78svh, 1100px); }
.reader.is-fullscreen .reader-heading { padding-top: 4px; }
@media (max-width: 720px) {
  .topbar { min-height: 62px; padding: 9px 17px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 10px; }
  .brand-copy small { font-size: 7px; }
  .edition { font-size: 8px; letter-spacing: .08em; }
  .reader { padding: 18px 10px 10px; }
  .reader-heading { align-items: center; padding: 0 6px 14px; }
  h1 { max-width: 240px; font-size: 20px; }
  .eyebrow { font-size: 8px; }
  .contents summary { padding: 9px 12px; font-size: 10px; }
  /* Keep the PageFlip viewport at the physical page ratio. An oversized
     frame makes StPageFlip center a portrait page inside its canvas, leaving
     exposed canvas below the page bounds followed by the PDF overlay. */
  .book-frame { width: 100%; height: auto; min-height: 0; aspect-ratio: 620 / 877; touch-action: pan-y; }
  .book-edge { width: 83%; }
  .reader-controls { gap: 7px; }
  .page-status { min-width: 133px; gap: 7px; font-size: 10px; }
  #reading-mode { display: none; }
  .fullscreen-button { padding: 0 11px; }
  .button-label { display: none; }
  .zoom-button { display: inline-flex; padding: 0 9px; font-size: 19px; }
  .zoom-dialog { position: fixed; inset: 0; }
  .reader-hint { max-width: 330px; align-self: center; font-size: 9px; }
  .footer { min-height: 32px; font-size: 7px; }
}
@media (any-pointer: coarse) {
  .book-frame { touch-action: pan-y; }
  .zoom-button { display: inline-flex; padding: 0 9px; font-size: 19px; }
}
@media (any-pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .topbar { min-height: 44px; height: 44px; padding: 4px 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .reader { min-height: 0; padding: 4px 10px 5px; }
  .reader-heading { align-items: center; gap: 8px; padding: 0 5px 4px; }
  .eyebrow { display: none; }
  h1 { max-width: 65vw; font-size: 17px; }
  .contents summary { padding: 6px 10px; font-size: 9px; }
  .book-stage { min-height: 0; padding: 0; }
  .book-frame { width: 100%; height: min(76svh, calc(100svh - 115px), 300px); min-height: 0; }
  .reader-controls { min-height: 32px; gap: 6px; }
  .control-button { min-width: 32px; min-height: 32px; }
  .page-status { min-width: 112px; gap: 6px; font-size: 9px; }
  .fullscreen-button { padding: 0 8px; }
  .zoom-button { display: inline-flex; min-width: 34px; min-height: 34px; }
  .reader-hint, .footer { display: none; }
}
@media (max-height: 430px) {
  .zoom-toolbar { min-height: 42px; padding: 4px 8px; gap: 5px; }
  .zoom-toolbar button { min-width: 32px; min-height: 32px; padding: 0 7px; }
  .zoom-scroll { height: calc(100dvh - 62px); }
  .zoom-hint { min-height: 20px; padding: 3px; font-size: 8px; }
}
@media (max-width: 360px) {
  .edition { display: none; }
  h1 { max-width: 210px; font-size: 18px; }
  .book-frame { min-height: 0; }
  .control-button { min-width: 35px; min-height: 35px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

