:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #06131f;
  color: #f6fbff;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  background:
    radial-gradient(circle at 50% 42%, rgba(17, 174, 190, .13), transparent 42%),
    linear-gradient(145deg, #020b12 0%, #061b2c 54%, #071522 100%);
}

button { font: inherit; }

.reader { position: relative; width: 100%; height: 100%; isolation: isolate; }

.reader::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, #000, transparent 72%);
}

.topbar {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  color: rgba(236, 250, 255, .9);
}

.brand { font-size: 14px; font-weight: 750; letter-spacing: .13em; }
.brand span { margin-left: 12px; color: #72cbd4; font-weight: 550; }

.icon-button, .nav-button {
  display: grid;
  place-items: center;
  border: 1px solid rgba(151, 225, 235, .22);
  background: rgba(6, 29, 44, .66);
  color: #eafcff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color .2s ease, background .2s ease, transform .2s ease, opacity .2s ease;
}

.icon-button { width: 40px; height: 40px; border-radius: 12px; }
.icon-button:hover, .nav-button:hover { border-color: rgba(70, 221, 233, .7); background: rgba(12, 75, 91, .72); }
.icon-button:active, .nav-button:active { transform: scale(.94); }
.icon-button svg, .nav-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.stage {
  position: absolute;
  inset: 54px 74px 76px;
  display: grid;
  place-items: center;
  perspective: 1500px;
  touch-action: none;
}

.page-shell {
  position: relative;
  width: min(100%, calc((100vh - 154px) * 1.7792));
  aspect-ratio: 1676 / 942;
  transform-style: preserve-3d;
  filter: drop-shadow(0 30px 42px rgba(0, 0, 0, .47));
}

.page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: clamp(4px, .45vw, 9px);
  background: #fff;
  backface-visibility: hidden;
  transform-origin: center center;
  user-select: none;
}

.incoming { visibility: hidden; }

.page-shadow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: clamp(4px, .45vw, 9px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), inset 0 -24px 38px rgba(0, 0, 0, .025);
}

.page-shell.next .current { animation: out-up .42s cubic-bezier(.55,.02,.65,.32) both; }
.page-shell.next .incoming { visibility: visible; animation: in-up .52s cubic-bezier(.18,.77,.26,1) both; }
.page-shell.previous .current { animation: out-down .42s cubic-bezier(.55,.02,.65,.32) both; }
.page-shell.previous .incoming { visibility: visible; animation: in-down .52s cubic-bezier(.18,.77,.26,1) both; }

@keyframes out-up {
  from { transform: translateY(0) rotateX(0); opacity: 1; }
  to { transform: translateY(-38%) rotateX(-55deg) scale(.92); opacity: 0; }
}

@keyframes in-up {
  from { transform: translateY(38%) rotateX(55deg) scale(.92); opacity: 0; }
  to { transform: translateY(0) rotateX(0) scale(1); opacity: 1; }
}

@keyframes out-down {
  from { transform: translateY(0) rotateX(0); opacity: 1; }
  to { transform: translateY(38%) rotateX(55deg) scale(.92); opacity: 0; }
}

@keyframes in-down {
  from { transform: translateY(-38%) rotateX(-55deg) scale(.92); opacity: 0; }
  to { transform: translateY(0) rotateX(0) scale(1); opacity: 1; }
}

.controls {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px;
  border: 1px solid rgba(151, 225, 235, .17);
  border-radius: 18px;
  background: rgba(2, 15, 25, .62);
  box-shadow: 0 12px 30px rgba(0,0,0,.24);
  backdrop-filter: blur(14px);
}

.nav-button { width: 40px; height: 36px; border-radius: 12px; }
.nav-button:disabled { opacity: .28; cursor: default; }
.page-status { min-width: 72px; text-align: center; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 650; letter-spacing: .08em; }
.divider { color: #3ec9d6; margin: 0 4px; }

.progress-track { position: absolute; z-index: 10; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.06); }
.progress { height: 100%; width: 0; background: linear-gradient(90deg, #13bcca, #68eef5); transition: width .35s ease; box-shadow: 0 0 16px rgba(53, 222, 233, .5); }

.hint { position: absolute; z-index: 8; right: 24px; bottom: 24px; margin: 0; color: rgba(210, 235, 241, .57); font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
.hint.hidden { opacity: 0; }

@media (max-width: 760px) {
  .topbar { height: 50px; padding: 0 12px; }
  .brand { font-size: 12px; }
  .brand span { display: none; }
  .stage { inset: 50px 8px 78px; }
  .page-shell { width: 100%; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .page-shell.next .current, .page-shell.next .incoming, .page-shell.previous .current, .page-shell.previous .incoming { animation-duration: .01ms; }
}
