:root {
  --page-w: 595;
  --page-h: 842;
  --bg: #e8e2d5;
  --bg-shadow: rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: #2b2b2b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#flipbook {
  max-width: min(1200px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  filter: drop-shadow(0 12px 28px var(--bg-shadow));
}

#flipbook[aria-hidden="true"] {
  visibility: hidden;
}

.page {
  position: relative;
  background: #fff;
  overflow: hidden;
}

.page canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pdf-link {
  position: absolute;
  display: block;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.pdf-link:hover {
  background: rgba(255, 215, 0, 0.22);
}

#loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
}

#loader[hidden] {
  display: none;
}

.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(0, 0, 0, 0.15);
  border-top-color: #2b2b2b;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

#loader-text {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.04em;
}

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