:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #24272b;
  background: #e9e9e7;
  --ground: #e9e9e7;
  --ink: #24272b;
  --line: #d9dcd9;
  --bar: 52px;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}
button:disabled {
  opacity: 0.28;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
section:focus-visible {
  outline: 3px solid #245b4c;
  outline-offset: 3px;
}
button:hover:enabled {
  background: #e9ece9;
}
button:active:enabled {
  transform: scale(0.96);
}
::selection {
  background: #b8d7cd;
  color: #142b24;
}
svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.symbols,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
[hidden] {
  display: none !important;
}
.skip {
  position: fixed;
  top: -80px;
  background: #fff;
  padding: 15px;
  z-index: 100;
}
.skip:focus {
  top: 8px;
}
.toolbar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--bar);
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 30;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 8px 3px;
  gap: 6px;
}
.toolbar button,
.thumb-panel header button {
  border: 0;
  background: transparent;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 5px;
}
.tool-divider {
  width: 24px;
  height: 1px;
  background: var(--line);
  margin: 5px;
}
.toolbar button[aria-pressed="true"],
.toolbar button[aria-expanded="true"] {
  color: #245b4c;
  background: #e4eeea;
}
.toolbar-brand {
  writing-mode: vertical-rl;
  margin-top: auto;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #626662;
  padding: 16px 0;
}
.reader {
  margin-left: var(--bar);
  height: 100dvh;
  background: var(--ground);
  position: relative;
  display: grid;
  grid-template-rows: 28px minmax(0, 1fr) 44px;
  transition: background 0.2s;
}
.publication-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 25px;
  min-width: 0;
}
.publication-heading h1 {
  font-size: 13px;
  font-weight: 400;
  margin: 0;
  opacity: 0.8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.publication-heading span {
  font-size: 11px;
  border: 1px solid currentColor;
  padding: 4px 7px;
  border-radius: 3px;
}
.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 38px;
  overflow: hidden;
  touch-action: pan-y;
  outline-offset: -3px;
  position: relative;
  perspective: 2600px;
  user-select: none;
}
.book {
  position: relative;
  display: flex;
  justify-content: center;
  transform-origin: center;
  filter: drop-shadow(0 9px 16px #0002);
}
.sheet {
  height: 100%;
  display: block;
  object-fit: contain;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
  flex: none;
  max-width: 100%;
}
.book.double:after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 10px);
  width: 20px;
  background: linear-gradient(
    90deg,
    transparent,
    #0002 48%,
    #0003 50%,
    #fff2 53%,
    transparent
  );
  pointer-events: none;
}
.turn-frame {
  position: absolute;
  top: 0;
  left: 0;
  perspective: 2600px;
  transform-origin: 0 0;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 3;
  will-change: transform;
}
.turn-base,
.turn-leaf,
.turn-face,
.turn-shadow,
.turn-shade {
  position: absolute;
  top: 0;
  height: 100%;
}
.turn-base,
.turn-leaf {
  width: 50%;
}
.turn-left {
  left: 0;
}
.turn-right,
.turn-leaf {
  left: 50%;
}
.turn-base {
  background: #fff;
  box-shadow: 0 5px 12px #0002;
}
.turn-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
}
.turn-leaf {
  transform-origin: left center;
  transform-style: preserve-3d;
  z-index: 5;
  will-change: transform;
}
.turn-leaf.reverse {
  left: 0;
  transform-origin: right center;
}
.turn-face {
  inset: 0;
  width: 100%;
  background: #fff;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 4px 10px #0002;
}
.turn-front {
  transform: translateZ(0.1px);
}
.turn-back {
  transform: rotateY(180deg) translateZ(0.1px);
}
.turn-shade {
  inset: 0;
  width: 100%;
  opacity: 0;
  background: linear-gradient(90deg, #0005, #0000 26%, #0000 65%, #0003);
}
.turn-back .turn-shade {
  background: linear-gradient(90deg, #0002, #fff0 40%, #0000 75%, #0005);
}
.turn-shadow {
  left: 50%;
  width: 50%;
  z-index: 2;
  opacity: 0;
  transform-origin: left center;
  background: linear-gradient(90deg, #0009, #0000 85%);
}
.turn-shadow.reverse {
  left: 0;
  transform-origin: right center;
  background: linear-gradient(270deg, #0009, #0000 85%);
}
.turn-frame.single .turn-base,
.turn-frame.single .turn-leaf,
.turn-frame.single .turn-shadow {
  left: 0;
  width: 100%;
}
.stage.turning {
  touch-action: none;
}
.page-arrow {
  z-index: 6;
  padding: 0;
  display: grid;
  place-items: center;
  position: absolute;
  top: calc(50% - 28px);
  border: 0;
  background: transparent;
  width: 36px;
  height: 56px;
  border-radius: 4px;
}
.page-arrow svg {
  width: 32px;
  height: 32px;
  stroke-width: 1.2;
}
.previous {
  left: 0;
}
.next {
  right: 0;
}
.reader-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  font-size: 12px;
  gap: 12px;
}
.reader-footer > span:first-child {
  position: absolute;
  left: 25px;
  color: inherit;
  opacity: 0.75;
}
.footer-title {
  position: absolute;
  right: 25px;
  max-width: 20%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.75;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.pagination button {
  background: none;
  border: 0;
  min-width: 40px;
  height: 44px;
  font-size: 20px;
}
.pagination input {
  width: 46px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: inherit;
  font: inherit;
  text-align: center;
  appearance: textfield;
  border-radius: 0;
  padding: 6px 0;
}
.pagination input::-webkit-inner-spin-button {
  appearance: none;
}
.empty {
  max-width: 460px;
  text-align: center;
  line-height: 1.7;
  padding: 20px;
}
.empty h2 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 500;
  text-wrap: balance;
}
.empty p {
  font-size: 15px;
  opacity: 0.8;
}
.empty a {
  display: block;
  color: inherit;
  margin: 14px auto;
  text-underline-offset: 5px;
}
.empty a:last-child {
  font-size: 12px;
}
.thumb-panel {
  position: fixed;
  inset: 0 auto 0 var(--bar);
  background: #fafbf9;
  width: 340px;
  max-width: calc(100vw - var(--bar));
  z-index: 25;
  box-shadow: 8px 0 25px #0002;
  display: flex;
  flex-direction: column;
}
.thumb-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.thumb-panel h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
}
.thumbnails {
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 14px;
  padding: 20px;
  scrollbar-color: #949e97 #f1f3f0;
}
.thumb {
  padding: 5px;
  border: 2px solid transparent;
  background: transparent;
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}
.thumb[aria-current="true"] {
  border-color: #245b4c;
}
.thumb img {
  width: 100%;
  aspect-ratio: 0.75;
  object-fit: contain;
  background: #eee;
  box-shadow: 0 3px 6px #0001;
}
.thumb span {
  font-size: 12px;
}
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #24272b;
  color: #fff;
  padding: 13px 20px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 80;
  max-width: 90vw;
}
.stage.zoomed {
  touch-action: none;
  cursor: grab;
}
.stage.zoomed:active {
  cursor: grabbing;
}
.zoomed .book {
  filter: none;
}
dialog {
  border: 0;
  border-radius: 12px;
  padding: 26px;
  max-width: 90vw;
  width: 440px;
  color: #24272b;
  box-shadow: 0 10px 50px #0003;
}
dialog::backdrop {
  background: #0007;
}
dialog h2 {
  margin-top: 0;
}
dialog label {
  font-size: 14px;
}
dialog input {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 10px;
}
dialog button {
  padding: 10px 18px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
}
@media (max-width: 1000px) {
  #readingHint,
  .footer-title {
    display: none;
  }
}
@media (max-width: 700px) {
  :root {
    --bar: 60px;
  }
  .toolbar {
    inset: auto 0 0;
    width: auto;
    height: calc(var(--bar) + env(safe-area-inset-bottom));
    padding: 8px 10px env(safe-area-inset-bottom);
    border-right: 0;
    border-top: 1px solid var(--line);
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }
  .tool-divider,
  .toolbar-brand {
    display: none;
  }
  .reader {
    margin-left: 0;
    height: calc(100dvh - var(--bar) - env(safe-area-inset-bottom));
    grid-template-rows: 30px minmax(0, 1fr) 44px;
  }
  .publication-heading {
    padding: 0 16px;
  }
  .stage {
    margin: 0 8px;
  }
  .page-arrow {
    top: auto;
    bottom: 0;
    width: 44px;
    height: 44px;
  }
  .page-arrow svg {
    width: 24px;
  }
  .previous {
    left: 0;
  }
  .next {
    right: 0;
  }
  .thumb-panel {
    inset: 0 0 calc(var(--bar) + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
  }
  .thumbnails {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .empty h2 {
    font-size: 23px;
  }
  .empty {
    padding: 12px;
  }
  .toast {
    bottom: 90px;
  }
  .reader-footer {
    padding: 0 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
