* {
  box-sizing: border-box;
}

html {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1c1c22;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 20px;
}

#book {
  margin: 0 auto;
  flex-shrink: 0;
}

.page {
  background: #fff;
  overflow: hidden;
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.controls {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #d8d8de;
  font-size: 15px;
}

.controls button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #33333c;
  color: #f2f2f5;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.controls button:hover {
  background: #45454f;
}

.controls button:focus-visible {
  outline: 2px solid #8a8aff;
  outline-offset: 2px;
}

.controls button.active {
  background: #6a6af0;
}

#page-indicator {
  min-width: 60px;
  text-align: center;
}

/* Bouton retour vers la page d'accueil (choix du classeur) */
.home-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #33333c;
  color: #f2f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  text-decoration: none;
  z-index: 500;
  transition: background 0.15s ease;
}

.home-btn:hover {
  background: #45454f;
}

/* Loupe qui suit la souris quand elle est activée */
#lens {
  position: fixed;
  display: none;
  border-radius: 50%;
  border: 3px solid #f2f2f5;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 1000;
}

body.zoom-active .page img {
  cursor: none;
}

/* Écran de chargement, tant que les 44 images ne sont pas arrivées */
#loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #1c1c22;
  color: #d8d8de;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  transition: opacity 0.4s ease;
}

#loader.loader-hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-bar-track {
  width: 240px;
  height: 6px;
  border-radius: 3px;
  background: #33333c;
  overflow: hidden;
}

.loader-bar-fill {
  height: 100%;
  width: 0%;
  background: #6a6af0;
  transition: width 0.2s ease;
}

/* La loupe suit la souris et se règle à la molette : inutilisable sur
   mobile (tactile), donc on masque le bouton en dessous de 700px. */
@media (max-width: 700px) {
  #zoom-toggle {
    display: none;
  }
}