.catalog-page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 34px var(--padx) 12px;
}

.catalog-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.catalog-intro .eyebrow {
  margin: 0 0 9px;
}

.catalog-intro h1 {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.catalog-intro p:not(.eyebrow) {
  max-width: 620px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.catalog-download {
  flex: 0 0 auto;
  min-width: 168px;
  min-height: 54px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 11px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 8%, transparent);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.catalog-download:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--blue) 14%, transparent);
}

.catalog-download svg {
  width: 22px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.catalog-download span {
  display: grid;
  gap: 1px;
}

.catalog-download b {
  font-size: 13px;
}

.catalog-download small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.catalog-reader {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius: 20px;
  background: #17191d;
  box-shadow: 0 22px 60px color-mix(in srgb, var(--ink) 20%, transparent);
}

.catalog-toolbar {
  min-height: 58px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  background: #111317;
  color: #fff;
}

.catalog-toolbar__group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reader-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, opacity .16s ease;
}

.reader-button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .14);
}

.reader-button:focus-visible,
.reader-edge:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.reader-button:disabled {
  opacity: .32;
  cursor: default;
}

.reader-button--icon {
  width: 40px;
  padding: 0;
}

.reader-button svg,
.reader-edge svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-status {
  min-width: 92px;
  color: rgba(255, 255, 255, .88);
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.reader-hint {
  color: rgba(255, 255, 255, .52);
  font-size: 11px;
}

.reader-stage {
  position: relative;
  height: min(78dvh, 860px);
  min-height: 520px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .08), transparent 50%),
    #24272d;
  touch-action: pan-y;
}

#viewer {
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .25s ease;
}

.catalog-reader.is-ready #viewer {
  opacity: 1;
}

#viewer iframe {
  background: transparent;
  box-shadow: 0 8px 36px rgba(0, 0, 0, .34);
}

/* 表紙・裏表紙は単ページ指定。EPUB.js は表示枠だけ半分幅にするため、
   1枚だけの時も見開きの左端へ寄らないよう中央へ置く。 */
#viewer .epub-container {
  justify-content: center;
}

.reader-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 13px;
  color: rgba(255, 255, 255, .72);
  pointer-events: none;
}

.catalog-reader.is-ready .reader-loading {
  display: none;
}

.reader-loading p {
  margin: 0;
  font-size: 13px;
}

.reader-spinner {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: #fff;
  border-radius: 50%;
  animation: reader-spin .8s linear infinite;
}

@keyframes reader-spin {
  to { transform: rotate(360deg); }
}

.reader-edge {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 46px;
  height: 68px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 12px;
  background: rgba(10, 12, 15, .58);
  color: #fff;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
  transition: background .16s ease, opacity .16s ease;
}

.reader-edge:hover:not(:disabled) {
  background: rgba(10, 12, 15, .82);
}

.reader-edge:disabled {
  opacity: 0;
  pointer-events: none;
}

.reader-edge--prev { left: 14px; }
.reader-edge--next { right: 14px; }

.reader-error {
  padding: 54px 24px;
  background: #24272d;
  color: #fff;
  text-align: center;
}

.reader-error h2 {
  margin: 0 0 8px;
  font-size: 21px;
}

.reader-error p {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, .66);
  font-size: 13px;
}

.reader-error a {
  display: inline-flex;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  color: #111317;
  font-size: 13px;
  font-weight: 700;
}

.catalog-reader:fullscreen {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.catalog-reader:fullscreen .reader-stage {
  height: calc(100dvh - 58px);
  min-height: 0;
}

/* 専用リーダーは新しいタブの全域を使う。Fullscreen APIを押さなくても
   ブラウザの表示領域いっぱいで読め、押した時はOSレベルの全画面になる。 */
.reader-only {
  min-height: 100dvh;
  overflow: hidden;
  background: #17191d;
}

.fullscreen-catalog {
  width: 100%;
  height: 100dvh;
}

.reader-only .catalog-reader {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.reader-only .reader-stage {
  height: calc(100dvh - 58px);
  min-height: 0;
}

.fullscreen-brand {
  min-width: 220px;
}

.fullscreen-brand a {
  display: flex;
  align-items: center;
  gap: 13px;
}

.fullscreen-brand__title {
  color: rgba(255, 255, 255, .78);
  font-size: 12px;
}

.fullscreen-pager {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.fullscreen-actions {
  margin-left: auto;
}

@media (max-width: 720px) {
  .catalog-page {
    padding-top: 22px;
  }

  .catalog-intro {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .catalog-download {
    align-self: flex-start;
  }

  .catalog-reader {
    margin-inline: calc(var(--padx) * -1);
    border-inline: 0;
    border-radius: 0;
  }

  .reader-hint {
    display: none;
  }

  .reader-stage {
    height: 70dvh;
    min-height: 430px;
  }

  .reader-edge {
    width: 40px;
    height: 58px;
  }

  .reader-edge--prev { left: 8px; }
  .reader-edge--next { right: 8px; }

  .reader-only .catalog-reader {
    margin-inline: 0;
  }

  .fullscreen-brand {
    min-width: 0;
  }

  .fullscreen-brand__title,
  .fullscreen-actions .reader-button span {
    display: none;
  }

  .fullscreen-actions .reader-button {
    width: 40px;
    padding: 0;
  }
}

@media (max-width: 420px) {
  .catalog-toolbar {
    gap: 8px;
  }

  .catalog-toolbar__group--right .reader-button span {
    display: none;
  }

  .catalog-toolbar__group--right .reader-button {
    width: 40px;
    padding: 0;
  }

  .page-status {
    min-width: 76px;
  }

  .reader-only .catalog-toolbar {
    padding-inline: 8px;
  }

  .reader-only .fullscreen-brand {
    display: none;
  }

  .reader-only .fullscreen-pager {
    position: static;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-download,
  .reader-button,
  .reader-edge,
  #viewer {
    transition: none;
  }

  .reader-spinner {
    animation-duration: 1.8s;
  }
}
