:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; color: #f5f7f8; background: #a6a9aa; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, select, a { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #2bd5a6; outline-offset: 2px; }
.toolbar { min-height: 54px; padding: 7px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #292e33; box-shadow: 0 2px 10px #1114; position: relative; z-index: 10; }
.brand { display: flex; align-items: baseline; gap: 11px; white-space: nowrap; }
.brand strong { font-size: 18px; letter-spacing: -.03em; }
.brand span { color: #b7c1c7; font-size: 13px; }
.tools, .pager { display: flex; align-items: center; gap: 4px; }
.tool { color: #e9eef1; background: transparent; border: 0; border-radius: 5px; min-width: 38px; height: 37px; padding: 0 9px; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.tool.icon { font-size: 22px; font-weight: 300; }
.tool:hover:not(:disabled), .tool[aria-pressed="true"] { background: #4c565e; }
.tool:disabled { color: #7a8288; cursor: default; }
.tool.download { color: #d1f7e9; }
.toolbar select { background: #f7f9fa; color: #263238; border: 0; border-radius: 3px; height: 30px; min-width: 79px; padding: 0 5px; text-align: center; font-size: 13px; }
.reader { position: relative; min-height: calc(100svh - 54px); display: flex; justify-content: center; align-items: center; padding: 12px 66px 32px; overflow: hidden; background: radial-gradient(ellipse at 50% 45%, #ebeded 0%, #d1d3d4 45%, #a7abad 100%); perspective: 2400px; }
.reader::before, .reader::after { content: ''; position: absolute; width: 35vw; height: 80%; top: 10%; pointer-events: none; opacity: .26; }
.reader::before { left: -15vw; background: linear-gradient(122deg, #fff9, transparent 48%); transform: skewX(-18deg); }
.reader::after { right: -15vw; background: linear-gradient(-122deg, #fff9, transparent 48%); transform: skewX(18deg); }
.book { --duration: .82s; width: min(1100px, calc((100svh - 105px) * 1190 / 842), calc(100vw - 150px)); aspect-ratio: 1190 / 842; position: relative; display: flex; align-items: stretch; z-index: 1; filter: drop-shadow(0 12px 10px #1a23284f); transform-style: preserve-3d; touch-action: pan-y; cursor: grab; }
.book:active { cursor: grabbing; }
.page-cell { display: block; position: relative; width: 50%; height: 100%; flex: 0 0 50%; background: #fff; overflow: hidden; }
.page-cell img, .turn-face img, .hold img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.page-cell img { cursor: zoom-in; }
.book.single { justify-content: center; }
.book.single .page-cell { box-shadow: 2px 0 3px #1727463d; }
.book.spread::after { content: ''; position: absolute; top: 0; bottom: 0; left: calc(50% - 13px); width: 26px; z-index: 2; pointer-events: none; background: linear-gradient(90deg, transparent, #242d3433 43%, #fff8 52%, transparent); }
.turn-sheet { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 5; transform-style: preserve-3d; pointer-events: none; }
.turn-sheet.forward { left: 50%; transform-origin: left center; animation: turnForward var(--duration) ease-in-out both; }
.turn-sheet.backward { left: 0; transform-origin: right center; animation: turnBackward var(--duration) ease-in-out both; }
.turn-face { position: absolute; inset: 0; background: white; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 1px 10px #17274650; }
.turn-face.back { transform: rotateY(180deg); }
.turn-face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #20283124, transparent 20%, transparent 75%, #20283125); }
.hold { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 4; background: white; }
.hold.left { left: 0; animation: holdOld var(--duration) both; }
.hold.right { right: 0; animation: holdOld var(--duration) both; }
.book.opening { animation: openCover .5s ease-out both; }
@keyframes turnForward { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes turnBackward { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
@keyframes holdOld { 0%, 47% { opacity: 1; } 53%, 100% { opacity: 0; } }
@keyframes openCover { from { opacity: .56; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.edge { position: absolute; z-index: 3; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: white; font-size: 48px; font-weight: 200; width: 54px; height: 90px; line-height: 1; text-shadow: 0 2px 8px #34404780; }
.edge:hover:not(:disabled) { background: #ffffff2b; }
.edge:disabled { opacity: .25; cursor: default; }
.edge.prev { left: 8px; } .edge.next { right: 8px; }
.hint { position: absolute; z-index: 2; bottom: 9px; left: 50%; transform: translateX(-50%); color: #3f484d; font-size: 13px; white-space: nowrap; }
.thumbs { background: #30373c; padding: 13px 24px; display: flex; justify-content: center; gap: 10px; overflow-x: auto; scrollbar-color: #839097 #30373c; }
.thumbs[hidden] { display: none; }
.thumb { flex: 0 0 57px; background: transparent; color: #d4dadd; border: 2px solid transparent; border-radius: 4px; padding: 4px; font-size: 12px; }
.thumb img { display: block; width: 100%; aspect-ratio: 595/842; object-fit: cover; margin-bottom: 4px; }
.thumb[aria-current="page"] { border-color: #26be94; color: white; }
dialog { border: 0; padding: 0; width: min(94vw, 1100px); max-height: 94vh; background: #e9eef1; box-shadow: 0 20px 80px #0009; }
dialog::backdrop { background: #161e25e0; }
.zoom-head { position: sticky; top: 0; z-index: 1; background: #292e33; color: white; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; }
.zoom-head button { background: #4c565e; color: white; border: 0; border-radius: 4px; padding: 7px 12px; }
.zoom-scroll { overflow: auto; max-height: calc(94vh - 50px); }
.zoom-scroll img { display: block; width: min(100%, 1000px); max-width: none; margin: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:fullscreen .reader { min-height: calc(100svh - 54px); }
@media (max-width: 1100px) {
  .toolbar { flex-wrap: wrap; justify-content: center; }
  .brand { width: 100%; justify-content: center; }
}
@media (max-width: 760px) {
  .toolbar { padding: 6px 8px; gap: 4px; flex-wrap: wrap; justify-content: center; }
  .brand { width: 100%; justify-content: center; }
  .brand span { display: none; }
  .tools { width: 100%; justify-content: center; flex-wrap: wrap; gap: 0; }
  .tool { min-width: 34px; padding: 0 6px; font-size: 13px; }
  #fullscreen-button { display: none; }
  .reader { min-height: calc(100svh - 100px); padding: 14px 38px 30px; }
  .book { width: min(calc(100vw - 82px), calc((100svh - 145px) * 595 / 842)); aspect-ratio: 595 / 842; }
  .book .page-cell { width: 100%; flex-basis: 100%; }
  .book.spread::after { display: none; }
  .turn-sheet { width: 100%; }
  .turn-sheet.forward, .turn-sheet.backward { left: 0; }
  .hold { display: none; }
  .edge { width: 35px; font-size: 36px; }
  .edge.prev { left: 0; } .edge.next { right: 0; }
  .hint { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .turn-sheet, .hold, .book.opening { animation: none; } }
