.pc-catalog {
  --pc-ink: #17353a;
  --pc-paper: #f7f2e8;
  --pc-accent: #df6d45;
  --pc-stage: #d7d1c4;
  color: var(--pc-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 1.5rem 0;
  min-width: 0;
}

.pc-shell {
  background: #f9f7f2;
  border: 1px solid rgba(23, 53, 58, 0.14);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(25, 38, 38, 0.16);
  display: flex;
  flex-direction: column;
  height: var(--pc-catalog-height, 780px);
  min-height: 480px;
  overflow: hidden;
}

.pc-shell [hidden] {
  display: none !important;
}

.pc-toolbar {
  align-items: center;
  background: rgba(249, 247, 242, 0.96);
  border-bottom: 1px solid rgba(23, 53, 58, 0.12);
  display: flex;
  flex: 0 0 auto;
  gap: 16px;
  justify-content: space-between;
  min-height: 62px;
  padding: 8px 14px 8px 20px;
  position: relative;
  z-index: 10;
}

.pc-toolbar__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-toolbar__controls {
  align-items: center;
  display: flex;
  gap: 8px;
}

.pc-button {
  align-items: center;
  background: transparent;
  border: 1px solid rgba(23, 53, 58, 0.2);
  border-radius: 999px;
  box-sizing: border-box;
  color: var(--pc-ink);
  cursor: pointer;
  display: inline-flex;
  font: 700 0.78rem/1 ui-sans-serif, system-ui, sans-serif;
  height: 38px;
  justify-content: center;
  min-width: 38px;
  padding: 0 11px;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.pc-button:hover:not(:disabled),
.pc-button:focus-visible {
  background: #ffffff;
  border-color: var(--pc-accent);
  outline: none;
  transform: translateY(-1px);
}

.pc-button:disabled {
  cursor: default;
  opacity: 0.32;
}

.pc-page-status {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  min-width: 72px;
  text-align: center;
}

.pc-stage {
  align-items: center;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.78), transparent 38%),
    linear-gradient(145deg, #e5dfd3, var(--pc-stage));
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  min-height: 0;
  outline: none;
  overflow: hidden;
  overscroll-behavior: contain;
  position: relative;
  touch-action: pan-y;
}

.pc-stage:focus-visible::after {
  border: 3px solid var(--pc-accent);
  border-radius: 12px;
  content: "";
  inset: 9px;
  pointer-events: none;
  position: absolute;
}

.pc-book {
  cursor: grab;
  filter: drop-shadow(0 25px 22px rgba(36, 38, 35, 0.25));
  flex: 0 0 auto;
  isolation: isolate;
  max-height: calc(100% - 44px);
  max-width: calc(100% - 36px);
  position: relative;
  touch-action: none;
  transform: translateZ(0);
  user-select: none;
}

.pc-scroll-pages {
  box-sizing: border-box;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-color: rgba(23, 53, 58, 0.38) transparent;
  width: 100%;
}

.pc-scroll-page {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  height: 100%;
  justify-content: center;
  padding: 18px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.pc-scroll-page__paper {
  background: #fff;
  box-shadow: 0 20px 24px rgba(36, 38, 35, 0.25);
  height: var(--pc-portrait-page-height);
  max-height: 100%;
  max-width: 100%;
  position: relative;
  width: var(--pc-portrait-page-width);
}

.pc-book:active {
  cursor: grabbing;
}

.pc-page {
  background: #fff;
  height: 100%;
  overflow: hidden;
  position: absolute;
  top: 0;
  width: 50%;
}

.pc-page--left {
  border-radius: 4px 0 0 4px;
  box-shadow: inset -20px 0 26px -26px rgba(0, 0, 0, 0.65);
  left: 0;
}

.pc-page--right {
  border-radius: 0 4px 4px 0;
  box-shadow: inset 20px 0 26px -26px rgba(0, 0, 0, 0.65);
  right: 0;
}

.pc-page--blank {
  background:
    repeating-linear-gradient(90deg, rgba(80, 70, 55, 0.02) 0 1px, transparent 1px 4px),
    #eee7d9;
}

.pc-page > canvas {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.pc-scroll-page__paper > canvas {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.pc-spine {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.34), rgba(0, 0, 0, 0.17), transparent);
  height: 100%;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  width: 18px;
  z-index: 4;
}

.pc-curl-canvas {
  height: 100%;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 80ms linear;
  width: 100%;
  z-index: 7;
}

.pc-curl-canvas.is-visible {
  opacity: 1;
}

.pc-fold-shadow {
  background: radial-gradient(ellipse at center, rgba(17, 24, 23, 0.42), transparent 68%);
  height: 106%;
  left: 41%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: -3%;
  transition: opacity 80ms linear;
  width: 18%;
  z-index: 6;
}

.pc-annotations {
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 5;
}

.pc-annotation-link {
  border: 2px solid transparent;
  border-radius: 4px;
  box-sizing: border-box;
  pointer-events: auto;
  position: absolute;
}

.pc-annotation-link:hover,
.pc-annotation-link:focus-visible {
  background: rgba(223, 109, 69, 0.12);
  border-color: var(--pc-accent);
  outline: none;
}

.pc-page-number {
  background: rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  bottom: 8px;
  color: rgba(23, 53, 58, 0.75);
  font-size: 10px;
  line-height: 1;
  padding: 5px 7px;
  pointer-events: none;
  position: absolute;
  z-index: 6;
}

.pc-page--left .pc-page-number { left: 9px; }
.pc-page--right .pc-page-number { right: 9px; }

.pc-loading {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
}

.pc-loading__spinner {
  animation: pc-spin 900ms linear infinite;
  border: 3px solid rgba(23, 53, 58, 0.18);
  border-radius: 50%;
  border-top-color: var(--pc-accent);
  height: 34px;
  width: 34px;
}

.pc-loading__text,
.pc-hint {
  color: rgba(23, 53, 58, 0.68);
  font-size: 0.78rem;
}

.pc-hint {
  bottom: 8px;
  left: 50%;
  margin: 0;
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.pc-error,
.pc-catalog-error {
  background: #fff5f2;
  border: 1px solid #d5826a;
  border-radius: 10px;
  color: #712f22;
  margin: 20px;
  max-width: 600px;
  padding: 16px;
}

.pc-shell:fullscreen {
  border: 0;
  border-radius: 0;
  height: 100vh;
}

.pc-shell--portrait .pc-stage {
  display: block;
  touch-action: pan-y;
}

.pc-shell--portrait .pc-hint {
  background: rgba(249, 247, 242, 0.84);
  border-radius: 999px;
  bottom: 10px;
  padding: 5px 9px;
  pointer-events: none;
  z-index: 8;
}

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

@media (max-width: 700px) {
  .pc-shell { min-height: 420px; }
  .pc-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
  }
  .pc-toolbar__title {
    font-size: 0.95rem;
    max-width: none;
    text-align: center;
  }
  .pc-toolbar__controls {
    gap: 6px;
    justify-content: center;
    min-width: 0;
  }
  .pc-button {
    height: 36px;
    min-width: 36px;
    padding: 0 9px;
  }
  .pc-page-status {
    font-size: 0.75rem;
    min-width: 60px;
  }
  .pc-hint { font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-button,
  .pc-curl-canvas,
  .pc-fold-shadow {
    transition: none;
  }
  .pc-loading__spinner { animation-duration: 1.8s; }
}
