:root {
  --navy: #17253e;
  --deep: #091321;
  --panel: #101d31;
  --blue: #45afe9;
  --blue-light: #65c6f4;
  --white: #f5f9fc;
  --muted: #94a7ba;
  --line: rgba(255,255,255,.11);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--white); background: var(--deep); font-family: "Exo 2", "Segoe UI", Arial, sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 3px; }

.app { height: 100dvh; display: grid; grid-template-rows: 70px minmax(0,1fr) 66px; background: #45494d; }
.topbar { z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(8,18,31,.95); border-bottom: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.22); }
.brand { display: flex; align-items: baseline; gap: 20px; }
.brand-logo { width: 148px; height: auto; display: block; filter: brightness(0) invert(1); }
.subtitle { margin:0; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; }
.top-actions { display: flex; gap: 8px; }
.top-actions button, .top-actions a { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 13px; color: #dce8f2; background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 12px; font-weight: 650; cursor: pointer; }
.top-actions button:hover, .top-actions a:hover { color: white; background: rgba(69,175,233,.17); border-color: rgba(69,175,233,.5); }
.top-actions span { color: var(--blue-light); font-size: 18px; }

.viewer { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 20px 74px; background:
  radial-gradient(ellipse at 50% 38%, rgba(255,255,255,.82) 0, rgba(255,255,255,.2) 43%, transparent 72%),
  linear-gradient(145deg, #d9dcdf 0%, #c6cacf 48%, #aeb4ba 100%);
}
.viewer::after { content:""; position:absolute; inset:0; pointer-events:none; background: linear-gradient(180deg,rgba(255,255,255,.28),transparent 18%,transparent 82%,rgba(70,77,84,.12)); }
.grid { display:none; }
.watermark { position: absolute; left: 2vw; bottom: -23vh; color: transparent; -webkit-text-stroke: 1px rgba(23,37,62,.045); font-family: Arial,sans-serif; font-size: 58vh; font-weight: 900; line-height: 1; pointer-events: none; }
.book-viewport { position: relative; width: 100%; height: 100%; overflow: auto; display: flex; align-items: center; justify-content: center; scrollbar-color: rgba(255,255,255,.25) transparent; cursor: zoom-in; touch-action: pan-y; }
.book-viewport.zoomed { cursor: grab; }
.book-viewport.zoomed.dragging { cursor: grabbing; user-select: none; }
.book { position: relative; flex: 0 0 auto; transform: translateX(0); clip-path: inset(-24px); transform-origin: center; }
.book.zoom-hidden { position: absolute; opacity: 0; pointer-events: none; }
.zoom-preview { flex:0 0 auto; display:flex; align-items:flex-start; justify-content:center; background:#fff; line-height:0; }
.zoom-preview[hidden] { display:none; }
.zoom-preview img { display:block; width:50%; height:100%; object-fit:fill; user-select:none; -webkit-user-drag:none; }
.zoom-preview.single img { width:100%; }
.page-links { position:absolute; z-index:6; left:50%; bottom:6px; width:min(calc(100% - 148px), 1400px); display:grid; grid-template-columns:1fr 1fr; gap:14px; transform:translateX(-50%); pointer-events:none; }
.page-links[hidden] { display:none; }
.page-links.single { grid-template-columns:1fr; width:min(calc(50% - 74px), 700px); }
.page-link-group { min-width:0; display:flex; justify-content:center; gap:6px; flex-wrap:wrap; }
.page-link-group a { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; pointer-events:auto; padding:6px 10px; color:#17324a; background:rgba(248,251,253,.94); border:1px solid rgba(23,50,74,.18); border-radius:6px; text-decoration:none; font-size:10px; font-weight:650; line-height:1; backdrop-filter:blur(8px); }
.page-link-group a:hover { color:#087eb9; border-color:rgba(69,175,233,.7); background:#fff; }
.page-link-group a span { margin-right:6px; color:var(--blue); font-size:12px; }
.book.ready { transition: transform .58s cubic-bezier(.22,.61,.36,1), clip-path .58s cubic-bezier(.22,.61,.36,1); }
.book .stf__wrapper { position:relative; z-index:2; }
.book canvas { display:block; box-shadow:none!important; filter:none!important; }
.book .stf__outerShadow,
.book .stf__innerShadow,
.book .stf__hardShadow,
.book .stf__hardInnerShadow { display:none!important; opacity:0!important; background:none!important; box-shadow:none!important; }
@media (min-width:901px) {
  .book.single-first { clip-path: inset(-24px -24px -24px 50%); transform: translateX(-25%); }
  .book.single-last { clip-path: inset(-24px 50% -24px -24px); transform: translateX(25%); }
}
.book.change-next { animation: changeNext .32s cubic-bezier(.22,.61,.36,1); }
.book.change-prev { animation: changePrev .32s cubic-bezier(.22,.61,.36,1); }
@keyframes changeNext {
  0% { opacity: 1; filter: blur(0); }
  43% { opacity: .15; transform: translateX(-18px) scale(.995); filter: blur(2px); }
  44% { transform: translateX(18px) scale(.995); }
  100% { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}
@keyframes changePrev {
  0% { opacity: 1; filter: blur(0); }
  43% { opacity: .15; transform: translateX(18px) scale(.995); filter: blur(2px); }
  44% { transform: translateX(-18px) scale(.995); }
  100% { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}
.page { position: relative; flex: 0 0 auto; height: min(70vh, calc((100vw - 154px) * .35375)); aspect-ratio: 400/283; margin: 0; background: #fff; box-shadow:none; overflow: hidden; }
.page img { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.page.left { transform-origin: right center; }
.page.right { transform-origin: left center; }
.page figcaption { position: absolute; bottom: 9px; left: 50%; transform: translateX(-50%); min-width: 28px; padding: 4px 7px; color: white; background: rgba(5,13,24,.72); border-radius: 4px; text-align: center; font-size: 10px; opacity: 0; transition: opacity .2s; }
.page:hover figcaption { opacity: 1; }
.page.hidden { display: none; }
.gutter { z-index: 2; width: 3px; align-self: stretch; background: linear-gradient(90deg,rgba(0,0,0,.2),rgba(255,255,255,.12),rgba(0,0,0,.18)); box-shadow:none; }
.book.cover .gutter, .book.cover .right { display: none; }
.book.cover .left { transform-origin: center; }
.turn-sheet { position: absolute; z-index: 8; top: 0; width: 50%; height: 100%; transform-style: preserve-3d; pointer-events: none; will-change: transform; }
.turn-sheet.next { left: 50%; transform-origin: left center; animation: pageTurnNext .66s cubic-bezier(.42,.04,.2,1) both; }
.turn-sheet.prev { left: 0; transform-origin: right center; animation: pageTurnPrev .66s cubic-bezier(.42,.04,.2,1) both; }
.turn-face { position: absolute; inset: 0; overflow: hidden; background: white; backface-visibility: hidden; box-shadow:none; }
.turn-face img { width: 100%; height: 100%; display: block; object-fit: fill; }
.turn-face.back { transform: rotateY(180deg); }
.turn-face::after { content:""; position:absolute; inset:0; opacity:0; background:linear-gradient(90deg,rgba(0,0,0,.42),rgba(255,255,255,.18) 46%,rgba(0,0,0,.28)); animation: sheetShade .66s ease-in-out both; }
@keyframes pageTurnNext {
  0% { transform: perspective(1800px) rotateY(0deg); }
  48% { transform: perspective(1800px) rotateY(-88deg) scaleX(.96); }
  100% { transform: perspective(1800px) rotateY(-180deg); }
}
@keyframes pageTurnPrev {
  0% { transform: perspective(1800px) rotateY(0deg); }
  48% { transform: perspective(1800px) rotateY(88deg) scaleX(.96); }
  100% { transform: perspective(1800px) rotateY(180deg); }
}
@keyframes sheetShade {
  0%,100% { opacity:.04; }
  48% { opacity:.75; }
}

.page-arrow { position: absolute; z-index: 5; top: 50%; width: 49px; height: 76px; transform: translateY(-50%); color: white; background: rgba(7,17,30,.64); border: 1px solid rgba(255,255,255,.14); border-radius: 9px; font-family: Arial,sans-serif; font-size: 43px; font-weight: 200; line-height: 1; cursor: pointer; backdrop-filter: blur(9px); transition: .2s; }
.page-arrow:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
.page-arrow:disabled { opacity: .16; cursor: default; }
.page-arrow.prev { left: 18px; }
.page-arrow.next { right: 18px; }
.loading { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 12px; color: #dce9f3; }
.loading span { width: 34px; height: 34px; border: 2px solid rgba(255,255,255,.14); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.loading b { font-size: 12px; }
.loading.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.controls { z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 0 28px; background: rgba(8,18,31,.96); border-top: 1px solid var(--line); }
.page-control,.zoom-control { display: flex; align-items: center; gap: 7px; }
.controls button { height: 34px; min-width: 34px; color: #edf7fc; background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.controls button:hover:not(:disabled) { background: rgba(69,175,233,.18); border-color: rgba(69,175,233,.5); }
.controls button:disabled { opacity: .28; cursor: default; }
.page-control label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.page-control input { width: 48px; height: 34px; color: white; background: #081425; border: 1px solid rgba(255,255,255,.17); border-radius: 6px; text-align: center; }
.page-control input::-webkit-inner-spin-button { appearance: none; }
#pageTotal { margin-right: 4px; color: var(--muted); font-size: 12px; }
.zoom-control { justify-self: center; }
#zoomValue { min-width: 58px; color: #bfd0dd; font-size: 11px; text-align: center; }
.controls .fit { width: auto; padding: 0 12px; color: var(--blue-light); font-size: 11px; }
.hint { justify-self: end; color: #72859a; font-size: 10px; letter-spacing: .04em; }

.backdrop { position: fixed; z-index: 19; inset: 0; visibility: hidden; opacity: 0; background: rgba(3,9,16,.7); backdrop-filter: blur(5px); transition: .25s; }
.backdrop.open { visibility: visible; opacity: 1; }
.drawer { position: fixed; z-index: 20; top: 0; right: 0; width: min(420px,92vw); height: 100dvh; padding: 24px; transform: translateX(102%); background: var(--panel); border-left: 1px solid var(--line); box-shadow: -25px 0 65px rgba(0,0,0,.4); overflow-y: auto; transition: transform .28s ease; }
.drawer.open { transform: translateX(0); }
.drawer header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.drawer header div { display: flex; flex-direction: column; gap: 4px; }
.drawer strong { font-size: 20px; }
.drawer header span { color: var(--muted); font-size: 11px; }
.drawer header button { color: white; background: transparent; border: 0; font-size: 29px; cursor: pointer; }
.catalog-info { margin-top:20px; padding:18px; color:#d8e4ed; background:rgba(255,255,255,.045); border:1px solid var(--line); border-radius:9px; font-size:12px; line-height:1.55; }
.catalog-info h2 { margin:0 0 10px; color:white; font-size:17px; line-height:1.25; }
.catalog-info h3 { margin:18px 0 8px; color:var(--blue-light); font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.catalog-info p { margin:7px 0; }
.catalog-info ul { margin:0; padding-left:18px; }
.catalog-info li { margin:6px 0; }
.catalog-info a { color:#78cef5; text-decoration:none; }
.catalog-info a:hover { color:white; text-decoration:underline; }
.catalog-info details { padding:8px 0; border-top:1px solid var(--line); }
.catalog-info summary { color:white; font-weight:650; cursor:pointer; }
.noscript-catalog { max-width:900px; margin:40px auto; padding:24px; color:#17253e; background:white; font-family:"Exo 2","Segoe UI",Arial,sans-serif; }
.thumbnails { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; padding-top: 20px; }
.thumb { position: relative; padding: 0; background: white; border: 2px solid transparent; border-radius: 5px; box-shadow: 0 8px 18px rgba(0,0,0,.25); overflow: hidden; cursor: pointer; }
.thumb img { width: 100%; display: block; }
.thumb span { position: absolute; right: 6px; bottom: 6px; min-width: 25px; padding: 4px; color: white; background: rgba(5,13,24,.76); border-radius: 3px; font-size: 9px; text-align: center; }
.thumb:hover,.thumb.active { border-color: var(--blue); transform: translateY(-2px); }

@media (max-width: 900px), (hover:none) and (pointer:coarse) {
  .app { grid-template-rows: 59px minmax(0,1fr) 61px; }
  .topbar { padding: 0 12px; }
  .brand-logo { width: 122px; }
  .subtitle,.top-actions b,.hint,.controls .fit { display: none; }
  .top-actions button,.top-actions a { width: 39px; justify-content: center; padding: 0; }
  .viewer { padding: 10px 12px; }
  .page-arrow { display:block; width:38px; height:60px; border-radius:0 8px 8px 0; font-size:34px; background:rgba(7,17,30,.68); }
  .page-arrow.prev { left:0; }
  .page-arrow.next { right:0; border-radius:8px 0 0 8px; }
  .page { width: calc(100vw - 24px); height: auto; max-height: calc(100dvh - 140px); aspect-ratio: 400/283; }
  .page img { width: 100%; height: 100%; }
  .book .gutter,.book .right { display: none; }
  .page-links.single { width: calc(100% - 24px); }
  .controls { grid-template-columns: 1fr auto; padding: 0 10px; }
  .zoom-control { justify-self: end; }
  #zoomValue { min-width: 48px; }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01ms!important; transition-duration:.01ms!important; }
}
