:root {
  color-scheme: light;
  --ink: #223b2b;
  --muted: #536257;
  --paper: #f7f6f0;
  font: 16px/1.55 "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
a { color: inherit; }
button, select { font: inherit; color: inherit; }
a:focus-visible, button:focus-visible, .book-viewport:focus-visible, .page-position:focus-within {
  outline: 2px solid #8b5b28;
  outline-offset: -3px;
}
[hidden] { display: none !important; }

.skip {
  position: fixed;
  inset: 8px auto auto 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--paper);
  transform: translateY(-140%);
}
.skip:focus { transform: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.masthead {
  display: grid;
  min-height: 48px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
}
.masthead h1 { margin: 0; font-size: .96rem; font-weight: 700; letter-spacing: .11em; }
.home-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-self: start;
  gap: 4px;
  padding-inline: 5px 8px;
  color: var(--muted);
  font-size: .8rem;
  text-decoration: none;
}
.home-link:hover { text-decoration: underline; text-underline-offset: .22em; }
.home-link svg, .icon-button svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.book-viewport {
  width: 100%;
  touch-action: pan-y pinch-zoom;
}
.book {
  display: grid;
  width: 100%;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin-inline: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.book[aria-disabled="false"] { cursor: pointer; }
.book-page { display: block; width: 100%; height: auto; aspect-ratio: 1202 / 1700; }
.book[data-turn="forward"] .book-page, .book[data-turn="back"] .book-page { animation: turn 140ms ease-out; }
@keyframes turn { from { opacity: .76; } to { opacity: 1; } }
.book-viewport.is-zoomed {
  overflow: auto;
  max-height: calc(100vh - 100px);
  max-height: calc(100svh - 100px);
  touch-action: pan-x pan-y pinch-zoom;
}
.is-zoomed .book { width: max(145%, 620px); }

.reader-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right));
}
.paging { display: flex; grid-column: 2; align-items: center; gap: 3px; }
.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.icon-button:hover:not(:disabled), .page-position:hover { background: #eaece3; }
.icon-button:disabled { color: #8c978d; cursor: default; }
#zoom { grid-column: 3; justify-self: end; }
#zoom[aria-pressed="true"] { background: #eaece3; }
#zoom[aria-pressed="true"] .zoom-plus { display: none; }
.page-position {
  position: relative;
  display: grid;
  min-width: 73px;
  height: 40px;
  place-items: center;
  padding-inline: 5px;
  border-radius: 6px;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.page-position select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.reader-hint { color: var(--muted); text-align: center; font-size: .85rem; }
.footer { margin-top: auto; padding: 13px 14px 16px; color: var(--muted); text-align: center; font-size: .73rem; }
.footer p { margin: 0 0 2px; }
.footer a { text-underline-offset: .24em; }

@media (min-width: 800px) and (hover: hover) and (pointer: fine) {
  .book {
    --cover-height: max(380px, calc(100svh - 96px));
    width: min(100%, calc(var(--cover-height) * .70706));
  }
  .book.is-spread { width: 100%; }
  .is-zoomed .book.is-spread { width: max(145%, 1240px); }
  .is-zoomed .book:not(.is-spread) { width: max(620px, calc(var(--cover-height) * 1.06)); }
}
@media (prefers-reduced-motion: reduce) {
  .book[data-turn] .book-page { animation: none; }
}
