.reader-stage {
  --swipe-shift-x: 0px;
  --swipe-shift-y: 0px;
  --swipe-scale: 1;
  --swipe-dim: 0;
}

.reader-stage::before,
.reader-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.reader-stage::before {
  background: rgba(15, 23, 42, var(--swipe-dim));
  opacity: 0;
  transition: opacity 140ms ease;
}

.reader-stage::after {
  opacity: 0;
  transition: opacity 120ms ease;
  background: radial-gradient(
    circle at 50% 85%,
    rgba(99, 102, 241, 0.16),
    transparent 28%
  );
}

.reader-stage.is-swiping::before,
.reader-stage.swipe-resetting::before,
.reader-stage.is-swiping::after {
  opacity: 1;
}

.reader-stage #book {
  transform: translate3d(var(--swipe-shift-x), var(--swipe-shift-y), 0)
    scale(var(--swipe-scale));
  will-change: transform;
}

.reader-stage.swipe-resetting #book {
  transition: transform 180ms cubic-bezier(0.22, 0.9, 0.24, 1);
}

.reader-stage.swipe-nav-enabled,
.reader-stage.swipe-nav-enabled #book,
.reader-stage.swipe-nav-enabled .stf__parent,
.reader-stage.swipe-nav-enabled .stf__wrapper,
.reader-stage.swipe-nav-enabled .stf__block {
  overscroll-behavior: contain;
}

.cover-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  pointer-events: none;
}

.cover-hint--desktop {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(6px);
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.cover-hint-badge {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 10px 7px;
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
}

.cover-hint-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cover-hint-up {
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -1px;
}

.cover-hint-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16px;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  white-space: nowrap;
}

.cover-hint-chevrons-up,
.cover-hint-chevrons-left {
  display: block;
  overflow: visible;
}

.cover-hint-chevrons-up path,
.cover-hint-chevrons-left path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cover-hint-chevrons-left {
  animation: coverHintLeftFloat 1.5s ease-in-out infinite;
}

.cover-hint-chevrons-up {
  animation: coverHintUpFloat 1.5s ease-in-out infinite;
}

.cover-hint-chevrons-left .l1,
.cover-hint-chevrons-up .u1 {
  opacity: 0.32;
}

.cover-hint-chevrons-left .l2,
.cover-hint-chevrons-up .u2 {
  opacity: 0.64;
}

.cover-hint-chevrons-left .l3,
.cover-hint-chevrons-up .u3 {
  opacity: 1;
}

@keyframes coverHintLeftFloat {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.74;
  }
  50% {
    transform: translateX(-4px);
    opacity: 1;
  }
}

@keyframes coverHintUpFloat {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.74;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (hover: none) and (pointer: coarse) {
  .reader-stage.swipe-nav-enabled,
  .reader-stage.swipe-nav-enabled #book,
  .reader-stage.swipe-nav-enabled .stf__parent {
    touch-action: none !important;
  }
}

@media (max-width: 600px) {
  .cover-hint-badge {
    padding: 6px 9px 7px;
    gap: 1px;
    border-radius: 16px;
  }

  .cover-hint-row {
    gap: 4px;
  }

  .cover-hint-up {
    height: 14px;
    margin-bottom: -1px;
  }

  .cover-hint {
    right: 10px;
    bottom: 10px;
  }

  .cover-hint-text {
    font-size: 11px;
  }

  .cover-hint-chevrons-left {
    width: 24px;
    height: 14px;
  }

  .cover-hint-chevrons-up {
    width: 16px;
    height: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reader-stage #book,
  .reader-stage.swipe-resetting #book,
  .reader-stage::before,
  .reader-stage::after,
  .cover-hint-chevrons-left,
  .cover-hint-chevrons-up {
    transition: none !important;
    animation: none !important;
  }
}
