/* Reader shell */

/*
 * 杂志在新标签页里读：这个容器就是那一页的全部内容，所以铺满整屏。
 * 首页那个标签保持原样，关掉杂志标签就回到书架原位。
 */
.reader-view {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--reader-ink);
  background:
    radial-gradient(ellipse at 50% 47%, rgba(70, 83, 74, 0.23), transparent 55%),
    radial-gradient(ellipse at 8% 2%, rgba(96, 68, 47, 0.1), transparent 32%),
    var(--reader-bg);
  /* 只用透明度淡入：带 transform 的动画会给内部 position:fixed 元素造包含块 */
  animation: readerViewIn 240ms ease-out both;
}

/* 自己点全屏按钮时本来也是整屏，这里只是把入场动画收掉 */
.reader-view:fullscreen {
  animation: none;
}

@keyframes readerViewIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reader-view::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.9%, rgba(255, 255, 255, 0.025) 50%, transparent 50.1%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.018), transparent 30%);
}

.reader-bar {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex: 0 0 76px;
  padding: 0 clamp(16px, 3vw, 38px);
  border-bottom: 1px solid rgba(241, 237, 227, 0.09);
  background: rgba(16, 21, 18, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.reader-bar-left,
.reader-bar-tools {
  display: flex;
  align-items: center;
}

.reader-bar-left {
  min-width: 0;
  gap: 16px;
}

.reader-bar-tools {
  gap: 4px;
}

/* 顶部缩放组：放大 / 比例 / 还原 */

.reader-zoom-group {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 6px;
  padding: 3px;
  border: 1px solid rgba(241, 237, 227, 0.09);
  border-radius: 999px;
  background: rgba(241, 237, 227, 0.035);
}

.reader-zoom-group .reader-icon-button {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

.reader-zoom-level {
  min-width: 44px;
  color: rgba(241, 237, 227, 0.62);
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}

.reader-view.is-zoomed .reader-zoom-level {
  color: var(--accent);
}

.reader-icon-button:disabled {
  color: rgba(241, 237, 227, 0.2);
  cursor: default;
  pointer-events: none;
}

.reader-icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: rgba(241, 237, 227, 0.66);
  font-size: 17px;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.reader-icon-button:hover {
  color: var(--reader-ink);
  background: rgba(241, 237, 227, 0.07);
  border-color: rgba(241, 237, 227, 0.08);
}

.reader-icon-button[aria-expanded="true"] {
  color: var(--reader-ink);
  background: rgba(241, 237, 227, 0.09);
}

.back-button {
  width: 41px;
  height: 41px;
  margin-left: -8px;
  border-color: rgba(241, 237, 227, 0.14);
}

.reader-mini-brand {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(241, 237, 227, 0.18);
  color: rgba(241, 237, 227, 0.82);
  font-family: var(--serif);
  font-size: 16px;
}

.reader-heading {
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid rgba(241, 237, 227, 0.16);
}

.reader-heading h1 {
  max-width: min(38vw, 500px);
  margin: 0;
  overflow: hidden;
  color: var(--reader-ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-heading p {
  margin: 3px 0 0;
  color: rgba(241, 237, 227, 0.37);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.14em;
}

.reader-fullscreen-button .icon-minimize,
.reader-fullscreen-button.is-fullscreen .icon-maximize {
  display: none;
}

.reader-fullscreen-button.is-fullscreen .icon-minimize {
  display: block;
}

.reader-more {
  position: relative;
}

.reader-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: 190px;
  padding: 7px;
  border: 1px solid rgba(241, 237, 227, 0.13);
  background: #1c2520;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
  animation: menuIn 180ms var(--ease-out);
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-5px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.reader-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  background: transparent;
  color: rgba(241, 237, 227, 0.78);
  font-size: 11px;
  text-align: left;
  transition: color 160ms ease, background-color 160ms ease;
}

.reader-menu button:hover {
  color: var(--reader-ink);
  background: rgba(241, 237, 227, 0.06);
}

.reader-menu button.danger {
  color: #d98a79;
}

.reader-menu button.danger:hover {
  color: #f1ad9e;
  background: rgba(184, 75, 49, 0.1);
}

.reader-menu [data-icon] {
  font-size: 14px;
}

.reader-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px clamp(58px, 6.5vw, 105px) 18px;
  overflow: hidden;
}

.reader-stage::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(80vw, 1200px);
  height: min(45vh, 590px);
  border-radius: 50%;
  background: rgba(130, 142, 126, 0.045);
  filter: blur(80px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.book-stage {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  perspective: 6000px;
  touch-action: none;
  transform-origin: 0 0;
  -webkit-tap-highlight-color: transparent;
}

.book-stage.is-zoomed {
  cursor: grab;
  will-change: transform;
}

.book-stage.is-panning {
  cursor: grabbing;
}

.reader-view.is-panning {
  -webkit-user-select: none;
  user-select: none;
}

.reader-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transform: translate(-50%, -50%);
  color: rgba(241, 237, 227, 0.45);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  transition: opacity 300ms ease;
}

.reader-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-mark {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 25px;
}

.loading-mark i {
  display: block;
  width: 1px;
  height: 100%;
  background: var(--accent);
  animation: loadingBars 1.15s ease-in-out infinite;
}

.loading-mark i:nth-child(2) {
  animation-delay: 150ms;
  height: 65%;
}

.loading-mark i:nth-child(3) {
  animation-delay: 300ms;
  height: 82%;
}

@keyframes loadingBars {
  0%, 100% { transform: scaleY(0.32); opacity: 0.35; }
  50% { transform: scaleY(1); opacity: 1; }
}

.reader-loading p {
  margin: 0;
}

/* Book */

.book {
  position: relative;
  display: grid;
  flex: none;
  background: #fff;
  box-shadow:
    0 38px 70px -28px rgba(0, 0, 0, 0.72),
    0 10px 22px -14px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.25);
  transform-style: preserve-3d;
  animation: bookArrive 620ms var(--ease-out) both;
}

.book.is-static {
  animation: none;
}

@keyframes bookArrive {
  from { opacity: 0; transform: translateY(12px) scale(0.986); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.book::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  box-shadow:
    inset 0 0 32px rgba(30, 25, 18, 0.065),
    inset 0 0 0 1px rgba(0, 0, 0, 0.045);
  pointer-events: none;
}

.book.is-spread::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 6;
  width: 44px;
  background: linear-gradient(90deg, transparent, rgba(29, 25, 19, 0.12) 44%, rgba(29, 25, 19, 0.2) 50%, rgba(29, 25, 19, 0.09) 57%, transparent);
  transform: translateX(-50%);
  pointer-events: none;
}

/* 只有一页的跨页：舞台仍是双页宽，单页固定在右半栏，左半栏留空 */
.book.is-half {
  background: transparent;
  box-shadow: none;
}

.book.is-half::before {
  box-shadow: none;
}

.book.is-half .book-page {
  box-shadow:
    0 38px 70px -28px rgba(0, 0, 0, 0.72),
    0 10px 22px -14px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.25);
}

.book.is-half .book-page.is-blank {
  background: transparent;
  box-shadow: none;
}

.book.is-half .book-page.is-blank::before,
.book.is-half .book-page.is-blank::after {
  content: none;
}

/* 左半栏留空时，把书脊阴影移到可见那页的左侧 */
.book.is-half .book-page:not(.is-blank)::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  width: 38px;
  background: linear-gradient(to right, rgba(29, 25, 19, 0.14), transparent);
  pointer-events: none;
}

.book.is-half .book-page:not(.is-blank)::after {
  content: none;
}

.book-page {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.book-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  background: #fff;
}

/* 页面视频：页面图里只有首帧海报，可播放的 <video> 叠在同一位置。
   位置与尺寸由 JS 按页面逻辑坐标换算成百分比写进行内样式。 */
.book-media {
  position: absolute;
  pointer-events: none;
}

/*
 * 链接热区：页面图上的文字点不了，这里按保存时量好的矩形铺透明层。
 * <a> 自己不吃指针（否则整页都被它盖住、翻页全废），
 * 只有每行的 .book-link-spot 接点击，浏览器仍会把点击算作祖先链接的激活。
 */
.book-media .book-link {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 1;
  pointer-events: none;
  text-decoration: none;
}

.book-media .book-link-spot {
  position: absolute;
  display: block;
  border-radius: 2px;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.book-media .book-link:hover .book-link-spot,
.book-media .book-link:focus-visible .book-link-spot {
  background: rgba(29, 92, 72, 0.16);
  box-shadow: 0 0 0 1px rgba(29, 92, 72, 0.45);
}

.book-media .book-link:focus-visible {
  outline: none;
}

.book-media .book-video {
  position: absolute;
  display: block;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
}

/*
 * 手机竖屏全屏时的兜底：浏览器不支持 screen.orientation.lock 就把视频转 90° 铺满屏幕。
 * 全屏元素上 UA 的 :fullscreen 规则带 !important，这条大概率被压掉，
 * 所以 JS 会先试着写一次、发现没生效就立刻撤掉这个类（不做无效挣扎）。
 */
.book-video.is-fake-landscape {
  position: fixed !important;
  inset: auto !important;
  top: 50% !important;
  left: 50% !important;
  width: 100vh !important;
  height: 100vw !important;
  max-width: none !important;
  max-height: none !important;
  transform: translate(-50%, -50%) rotate(90deg) !important;
  object-fit: contain !important;
  z-index: 2147483647 !important;
}

.book-page:first-child::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(to left, rgba(29, 25, 19, 0.075), transparent);
  pointer-events: none;
}

.book.is-spread .book-page:first-child::after {
  width: 30px;
  background: linear-gradient(to left, rgba(29, 25, 19, 0.13), transparent);
}

.book-page:last-child::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  width: 16px;
  background: linear-gradient(to right, rgba(29, 25, 19, 0.07), transparent);
  pointer-events: none;
}

.book.is-spread .book-page:last-child::before {
  width: 38px;
  background: linear-gradient(to right, rgba(29, 25, 19, 0.14), transparent);
}

.book.is-single .book-page::before,
.book.is-single .book-page::after {
  display: none;
}

.reader-arrow {
  position: absolute;
  top: 50%;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 43px;
  height: 78px;
  padding: 0;
  border: 1px solid rgba(241, 237, 227, 0.1);
  background: rgba(241, 237, 227, 0.03);
  color: rgba(241, 237, 227, 0.45);
  font-size: 20px;
  transform: translateY(-50%);
  transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}

.reader-arrow:hover {
  color: var(--reader-ink);
  background: rgba(241, 237, 227, 0.07);
  border-color: rgba(241, 237, 227, 0.18);
}

.reader-arrow[disabled] {
  opacity: 0;
  pointer-events: none;
}

.reader-arrow-prev {
  left: clamp(12px, 2.2vw, 34px);
}

.reader-arrow-next {
  right: clamp(12px, 2.2vw, 34px);
}

.reader-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  z-index: 4;
  color: rgba(241, 237, 227, 0.25);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.13em;
  transform: translateX(-50%);
  transition: opacity 500ms ease;
  pointer-events: none;
}

.reader-hint.is-hidden {
  opacity: 0;
}

/* Page-turn animation */

.flip-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 10;
  width: 50%;
  opacity: 0;
  transform-origin: left center;
  will-change: transform, opacity;
  pointer-events: none;
}

.flip-shadow.is-next {
  right: 0;
  background: linear-gradient(90deg, rgba(17, 14, 10, 0.46), rgba(17, 14, 10, 0.14) 48%, transparent 82%);
}

.flip-shadow.is-prev {
  left: 0;
  transform-origin: right center;
  background: linear-gradient(270deg, rgba(17, 14, 10, 0.46), rgba(17, 14, 10, 0.14) 48%, transparent 82%);
}

.flip-leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 12;
  width: 50%;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}

.flip-leaf.is-next {
  right: 0;
  transform-origin: left center;
  animation: flipNext 600ms cubic-bezier(0.35, 0.08, 0.18, 1) forwards;
}

.flip-leaf.is-prev {
  left: 0;
  transform-origin: right center;
  animation: flipPrev 600ms cubic-bezier(0.35, 0.08, 0.18, 1) forwards;
}

@keyframes flipNext {
  0% {
    transform: rotateY(0deg) translateZ(0);
    animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
  }
  52% {
    transform: rotateY(-82deg) translateZ(6px);
    animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  100% { transform: rotateY(-180deg) translateZ(0); }
}

@keyframes flipPrev {
  0% {
    transform: rotateY(0deg) translateZ(0);
    animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
  }
  52% {
    transform: rotateY(82deg) translateZ(6px);
    animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  100% { transform: rotateY(180deg) translateZ(0); }
}

.flip-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 26px rgba(0, 0, 0, 0.13);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  -webkit-user-drag: none;
}

.flip-back {
  transform: rotateY(180deg);
}

.flip-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, transparent 55%, rgba(20, 18, 14, 0.17));
  pointer-events: none;
}

.flip-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(20, 18, 14, 0.17), transparent 55%);
  pointer-events: none;
}

.flip-leaf.is-next .flip-front,
.flip-leaf.is-prev .flip-back {
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.16);
}

/* 单页翻页：书页绕外缘旋转，整页揭开 */
.book.is-peel-single .flip-leaf,
.book.is-peel-single .flip-shadow {
  width: 100%;
}

.book.is-peel-single .flip-leaf.is-next {
  transform-origin: right center;
}

.book.is-peel-single .flip-leaf.is-prev {
  transform-origin: left center;
}

.book.is-peel-single .flip-shadow.is-next {
  transform-origin: right center;
  background: linear-gradient(270deg, rgba(17, 14, 10, 0.46), rgba(17, 14, 10, 0.14) 48%, transparent 82%);
}

.book.is-peel-single .flip-shadow.is-prev {
  background: linear-gradient(90deg, rgba(17, 14, 10, 0.46), rgba(17, 14, 10, 0.14) 48%, transparent 82%);
}

/* 跟手翻页：页角折角提示 */

.book-corner {
  position: absolute;
  z-index: 20;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

.book-corner::before,
.book-corner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

/* 折角投影 */
.book-corner::before {
  opacity: 0.5;
}

/* 折角亮边 */
.book-corner::after {
  opacity: 0;
}

.book:hover .book-corner,
.book-corner:focus-visible {
  opacity: 1;
}

.book-corner:hover::before,
.book-corner:focus-visible::before {
  opacity: 1;
}

.book-corner:hover::after,
.book-corner:focus-visible::after {
  opacity: 0.9;
}

.book-corner.is-next-br {
  right: 0;
  bottom: 0;
}

.book-corner.is-next-br::before {
  background: linear-gradient(225deg, rgba(22, 18, 12, 0.34), rgba(22, 18, 12, 0.09) 46%, transparent 68%);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.book-corner.is-next-br::after {
  background: linear-gradient(225deg, transparent 47.4%, rgba(255, 255, 255, 0.92) 49%, rgba(255, 255, 255, 0.92) 50.4%, transparent 52%);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.book-corner.is-next-tr {
  top: 0;
  right: 0;
}

.book-corner.is-next-tr::before {
  background: linear-gradient(135deg, rgba(22, 18, 12, 0.34), rgba(22, 18, 12, 0.09) 46%, transparent 68%);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.book-corner.is-next-tr::after {
  background: linear-gradient(135deg, transparent 47.4%, rgba(255, 255, 255, 0.92) 49%, rgba(255, 255, 255, 0.92) 50.4%, transparent 52%);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.book-corner.is-prev-tl {
  top: 0;
  left: 0;
}

.book-corner.is-prev-tl::before {
  background: linear-gradient(45deg, rgba(22, 18, 12, 0.34), rgba(22, 18, 12, 0.09) 46%, transparent 68%);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.book-corner.is-prev-tl::after {
  background: linear-gradient(45deg, transparent 47.4%, rgba(255, 255, 255, 0.92) 49%, rgba(255, 255, 255, 0.92) 50.4%, transparent 52%);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.book-corner.is-prev-bl {
  bottom: 0;
  left: 0;
}

.book-corner.is-prev-bl::before {
  background: linear-gradient(315deg, rgba(22, 18, 12, 0.34), rgba(22, 18, 12, 0.09) 46%, transparent 68%);
  clip-path: polygon(0 100%, 100% 100%, 0 0);
}

.book-corner.is-prev-bl::after {
  background: linear-gradient(315deg, transparent 47.4%, rgba(255, 255, 255, 0.92) 49%, rgba(255, 255, 255, 0.92) 50.4%, transparent 52%);
  clip-path: polygon(0 100%, 100% 100%, 0 0);
}

.reader-view.is-peeling .book-stage {
  cursor: grabbing;
}

.reader-view.is-peeling {
  -webkit-user-select: none;
  user-select: none;
}

@media (hover: none) {
  /* 触屏设备没有 hover，常显折角提示 */
  .book-corner {
    opacity: 0.72;
  }
}

/* Paged corner-curl overlay */

.pageflip-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  overflow: hidden;
  background: #fff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pageflip-overlay.is-ready {
  opacity: 1;
  visibility: visible;
}

.pageflip-overlay::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 30;
  width: 44px;
  background: linear-gradient(90deg, transparent, rgba(29, 25, 19, 0.12) 44%, rgba(29, 25, 19, 0.2) 50%, rgba(29, 25, 19, 0.09) 57%, transparent);
  transform: translateX(-50%);
  transition: opacity 90ms linear;
  pointer-events: none;
}

.pageflip-overlay.is-flipping::after {
  opacity: 0;
}

.pageflip-book {
  width: 100%;
  height: 100%;
}

.pageflip-page {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.pageflip-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
}

/* Reader footer */

.reader-footer {
  position: relative;
  z-index: 22;
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(280px, 1.8fr) minmax(100px, 1fr);
  align-items: center;
  gap: 20px;
  flex: 0 0 72px;
  padding: 0 clamp(20px, 4vw, 52px);
  border-top: 1px solid rgba(241, 237, 227, 0.08);
  background: rgba(16, 21, 18, 0.64);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.reader-footer-side {
  display: flex;
  align-items: center;
  min-width: 0;
}

.reader-footer-right {
  justify-content: flex-end;
  gap: 18px;
}

.reader-page-label {
  color: rgba(241, 237, 227, 0.55);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.reader-scrubber {
  display: flex;
  align-items: center;
  gap: 15px;
}

.scrubber-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(241, 237, 227, 0.38);
  font-size: 16px;
  transition: color 160ms ease;
}

.scrubber-button:hover {
  color: var(--reader-ink);
}

.scrubber-button:disabled {
  opacity: 0.22;
  pointer-events: none;
}

.page-slider {
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.page-slider::-webkit-slider-runnable-track {
  height: 1px;
  background: linear-gradient(to right, var(--accent) 0 var(--slider-progress, 0%), rgba(241, 237, 227, 0.16) var(--slider-progress, 0%) 100%);
}

.page-slider::-moz-range-track {
  height: 1px;
  background: rgba(241, 237, 227, 0.16);
}

.page-slider::-moz-range-progress {
  height: 1px;
  background: var(--accent);
}

.page-slider::-webkit-slider-thumb {
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--reader-ink);
  box-shadow: 0 0 0 4px rgba(241, 237, 227, 0.07);
  appearance: none;
  -webkit-appearance: none;
  transition: transform 150ms ease;
}

.page-slider:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.page-slider::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 50%;
  background: var(--reader-ink);
}

.reader-keys {
  color: rgba(241, 237, 227, 0.28);
  font-size: 8px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.reader-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  margin: 0 1px;
  border: 1px solid rgba(241, 237, 227, 0.13);
  font-family: var(--mono);
  font-size: 8px;
}

.reader-thumb-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(241, 237, 227, 0.13);
  background: transparent;
  color: rgba(241, 237, 227, 0.52);
  font-size: 9px;
  letter-spacing: 0.05em;
  transition: color 180ms ease, border-color 180ms ease;
}

.reader-thumb-toggle:hover {
  color: var(--reader-ink);
  border-color: rgba(241, 237, 227, 0.24);
}

/* Thumbnails */

.thumb-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  width: min(356px, 92vw);
  border-left: 1px solid rgba(241, 237, 227, 0.1);
  background: var(--reader-panel);
  box-shadow: -30px 0 70px rgba(0, 0, 0, 0.32);
  transform: translateX(102%);
  transition: transform 380ms var(--ease-out);
  visibility: hidden;
}

.thumb-panel.is-open {
  transform: translateX(0);
  visibility: visible;
}

.thumb-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex: none;
  padding: 27px 24px 20px;
  border-bottom: 1px solid rgba(241, 237, 227, 0.08);
}

.panel-kicker {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.thumb-panel-head h2 {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
}

.thumb-panel-head .reader-icon-button {
  width: 30px;
  height: 30px;
  margin-top: -3px;
  margin-right: -4px;
}

.thumb-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 25px 18px;
  overflow-y: auto;
  flex: 1;
  padding: 23px 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(241, 237, 227, 0.16) transparent;
}

.thumb-list::-webkit-scrollbar {
  width: 5px;
}

.thumb-list::-webkit-scrollbar-thumb {
  background: rgba(241, 237, 227, 0.16);
}

.thumb-card {
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(241, 237, 227, 0.42);
  text-align: left;
}

.thumb-image {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid rgba(241, 237, 227, 0.09);
  background: #232b26;
  transition: border-color 180ms ease, transform 240ms var(--ease-out), box-shadow 240ms ease;
}

.thumb-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-card:hover .thumb-image {
  border-color: rgba(241, 237, 227, 0.28);
  transform: translateY(-2px);
}

.thumb-number {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.thumb-number::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(241, 237, 227, 0.09);
}

.thumb-card.is-active {
  color: var(--accent);
}

.thumb-card.is-active .thumb-image {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(184, 75, 49, 0.17);
}

.thumb-card.is-active .thumb-number::after {
  background: var(--accent);
}

.thumb-note {
  flex: none;
  margin: 0;
  padding: 16px 24px 21px;
  border-top: 1px solid rgba(241, 237, 227, 0.08);
  color: rgba(241, 237, 227, 0.3);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.09em;
}

.thumb-scrim {
  position: absolute;
  inset: 0;
  z-index: 54;
  background: rgba(6, 9, 7, 0.56);
  backdrop-filter: blur(2px);
  animation: fadeIn 250ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .reader-view {
    animation: none;
  }
}
