body {
  font-family: Arial, sans-serif;
  background: #ececec;
  text-align: center;
}

.title {
  margin: 20px 0;
}

.scene {
  perspective: 2000px;
}

.book {
  position: relative;
  width: 340px;
  height: 480px;
  margin: auto;
  transform-style: preserve-3d;
}

.page {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-origin: left;
  transform-style: preserve-3d;
  transition: transform 1s;
  box-shadow: 0 15px 25px rgba(0,0,0,0.3);
  z-index: calc(100 - var(--i));
  background: #fff;
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
}

.page::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  transform: rotateY(180deg);
  backface-visibility: hidden;
}

.page.flipped {
  transform: rotateY(-180deg);
}

.controls {
  margin-top: 25px;
}

button {
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
}

.fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.fullscreen img {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 30px 60px rgba(0,0,0,0.8);
  border-radius: 6px;
  animation: zoomIn .4s ease;
}

@keyframes zoomIn {
  from {
    transform: scale(.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.book {
  position: relative;
  width: 340px;
  height: 480px;
  margin: auto;
  transform-style: preserve-3d;
  box-shadow:
    0 40px 60px rgba(0,0,0,0.4),
    inset 0 0 30px rgba(0,0,0,0.15);
  border-radius: 6px;
}

.book {
  position: relative;
  width: 340px;
  height: 480px;
  margin: auto;
  transform-style: preserve-3d;
  box-shadow:
    0 40px 60px rgba(0,0,0,0.4),
    inset 0 0 30px rgba(0,0,0,0.15);
  border-radius: 6px;
}
