.flipbook-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  margin: 20px auto;
  position: relative;
  touch-action: pan-y; /* Allows normal page scrolling when not directly touching book */
}

.flipbook-loader {
  font-size: 15px;
  color: #666;
  padding: 24px;
}

/* Fluid container for responsive scaling */
.flipbook-container {
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  margin: 0 auto;
}

.flipbook-container .page {
  background-color: #ffffff;
  overflow: hidden;
}

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

/* Bottom toolbar */
.flipbook-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
  flex-wrap: wrap;
}

.flipbook-btn {
  background: #23282d;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  touch-action: manipulation;
  user-select: none;
  transition: background 0.2s ease;
}

.flipbook-btn:hover {
  background: #0073aa;
}

.flipbook-page-info {
  font-size: 14px;
  color: #444;
  min-width: 110px;
  text-align: center;
}

/* Mobile viewport adjustments */
@media (max-width: 768px) {
  .flipbook-wrapper {
    margin: 10px auto;
    padding: 0 8px;
  }

  .flipbook-controls {
    gap: 8px;
  }

  .flipbook-btn {
    padding: 10px 18px; /* Larger tap targets on touch devices */
    font-size: 15px;
  }
}
