* {
  padding: 0;
  margin: 0;
  font-family: sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: #1a1a1a; /* Fondo negro */
  font-family: 'Montserrat', sans-serif;
  overflow: hidden;
}

p {
  margin-top: 10px;
  font-size: 13px;
  text-align: justify;
}

.container, .book-content {
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  width: 100%;
  min-height: calc(100vh - 160px);
  background: transparent;
  padding: 20px;
  box-sizing: border-box;
}

.book-content {
  width: 55%;
  min-width: 400px;
  max-width: 550px;
  height: 500px;
  position: relative;
  perspective: 1000px;
  transition: 1s;
}

@media screen and (max-width: 800px) {
  p { font-size: 12px; }
}

/* =========================
   Flipbook base
========================= */
.viewer {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.flip-book {
  width: 95vw;
  height: auto;
  max-height: 90vh; /* evita recorte inferior en PC */
  margin: auto;
}

.page {
  background: white;
  overflow: hidden;
  transform-style: preserve-3d;
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
}

.page.cover img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* Botones de navegación */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
  background: rgba(212,175,55,0.2);
  color: var(--accent-gold, #d4af37);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 1px solid var(--accent-gold, #d4af37);
  cursor: pointer;
}

.nav-btn:first-of-type { left: 10px; }
.nav-btn:last-of-type { right: 10px; }

/* Botones superiores */
.top-controls {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 15px;
  z-index: 1000;
}

.control-btn {
  background: var(--accent-gold, #d4af37);
  color: #1a1a1a;
  padding: 10px 16px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease;
}
.control-btn:hover { background: rgba(212,175,55,0.8); }

/* Botones de zoom */
.zoom-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.zoom-controls button {
  background: var(--accent-gold, #d4af37);
  color: #1a1a1a;
  border: none;
  padding: 10px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.zoom-controls button:hover { background: rgba(212,175,55,0.8); }

/* =========================
   Ajustes para pantallas pequeñas
========================= */
@media (max-width: 768px) {
  .viewer {
    height: 100vh;
    align-items: flex-start;
  }

  .flip-book {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
  }

  .nav-btn {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }
  .nav-btn:first-of-type { left: 5px; }
  .nav-btn:last-of-type { right: 5px; }

  .control-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .zoom-controls button {
    padding: 6px;
    font-size: 12px;
  }

  .zoom-controls {
    bottom: 10px;
    right: 10px;
  }

  /* Portada y contraportada centradas verticalmente */
  .page.cover {
    display: flex;
    align-items: center;   /* centra verticalmente */
    justify-content: center;
  }

  .page.cover img {
    width: auto;
    max-width: 100%;
    height: 100%;          /* ocupa todo el alto disponible */
    object-fit: contain;   /* mantiene proporción */
  }
}