#scene {
  display: none;
}

.scene {
  width: 100%;
  height: 75vh;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 2000px;
  position: relative;
  flex-direction: column;
  background: transparent;
  border-radius: 10px;
}

.book {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  overflow: visible;
  transition: transform 0.5s ease;
  transform: translateX(0);
  border-radius: 8px;
  background: transparent;
}

.page {
  cursor: pointer;
  position: absolute;
  color: black;
  width: 100%;
  max-width: 400px;
  height: 100%;
  margin: 0 auto;
  left: 0;
  right: 0;
  transform-style: preserve-3d;
  transform-origin: left center;
  z-index: 0;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Media Queries para Responsividad */
@media (max-width: 768px) {
  .scene {
    height: 60vh;
    perspective: 1000px;
  }
  
  .page {
    max-width: 90%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  }
  
  .nav-buttons {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    z-index: 1051;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  }
  
  .nav-buttons button {
    padding: 8px 16px;
    font-size: 14px;
    flex: 1;
  }
}

@media (max-width: 480px) {
  .scene {
    height: 50vh;
  }
  
  .page {
    max-width: 100%;
  }
  
  .nav-buttons {
    gap: 10px;
    padding: 10px;
  }
  
  .nav-buttons button {
    padding: 8px 12px;
    font-size: 13px;
  }
}

.page.active {
  pointer-events: auto;
  z-index: 2;
}

.front,
.back {
  position: absolute;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  backface-visibility: hidden;
  background: white;
  overflow: hidden;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1),
             inset 0 0 15px rgba(0, 0, 0, 0.03);
}

.back {
  transform: rotateY(180deg);
}

.page.flipped {
  transform: rotateY(-180deg);
}

canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  padding-bottom: 10px;
  position: relative;
  z-index: 1051;
}

.nav-buttons button {
  padding: 10px 24px;
  font-size: 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.nav-buttons button:hover {
  background-color: #0056b3;
}

.mfp-content {
  width: 90% !important;
  max-width: 1000px !important;
  overflow: visible !important;
  padding: 20px 0;
}

#flipbookLoading {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  z-index: 9999;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}