/* 漫画阅读器 — htmltibiu416/chapter.html, behaviour in js/reader/comic.js. Bars, sheets and states: base.css. */

/* ---------- Scroll mode: one column of pages ---------- */
.cr-pages { max-width: var(--cr-width, 800px); margin: 0 auto; }
.cr-page { position: relative; background: var(--cr-placeholder); }
.cr-page img { display: block; width: 100%; height: auto; }
.cr-page.is-loading, .cr-page.is-failed { aspect-ratio: var(--cr-ratio, 3 / 4); }
.cr-page.is-loading img { opacity: 0; }
.cr-page.is-loading::before {
  content: attr(data-index);
  position: absolute;
  top: 50%;
  left: 50%;
  color: var(--tb-muted);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  opacity: .5;
  transform: translate(-50%, -50%);
}
.cr-page:not(.is-loading):not(.is-failed) { background: none; }
.cr-page.is-failed img { visibility: hidden; }
.cr-page__retry {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 32px);
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--tb-line-strong);
  border-radius: 18px;
  background: var(--tb-surface);
  color: var(--tb-ink);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  cursor: pointer;
}
.cr-page__retry ti-icon { --ti-icon-size: 16px !important; width: 16px; height: 16px; }

/* Ad slot in the newest end card (advert/chapter_smart.js) */
.cr-ad { width: 100%; }
.cr-ad__slot:empty { display: none; }
.cr-pages > .cr-end:last-child { padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Paged mode: a horizontal strip, one screen per page ---------- */
html[data-cr-mode="page"] .cr-pages {
  display: flex;
  max-width: none;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
html[data-cr-mode="page"] .cr-pages::-webkit-scrollbar { display: none; }
html[data-cr-mode="page"] .cr-pages > * { direction: ltr; box-sizing: border-box; flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
html[data-cr-mode="page"] .cr-page { aspect-ratio: auto; background: none; }
html[data-cr-mode="page"] .cr-page img { width: 100%; height: 100%; object-fit: contain; }
html[data-cr-mode="page"] :is(.cr-end, .cr-state) { justify-content: center; min-height: 0; overflow-y: auto; padding: calc(var(--cr-top-h) + 24px) var(--tb-gutter) 140px; }
