* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  font-family: system-ui, sans-serif;
  color: #fff;
  padding: 20px 10px 80px; /* espacio para la barra fija inferior */
}

#title-bar {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  opacity: 0.85;
  text-align: center;
}

#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 60px 0;
}

#loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading-text { font-size: 0.9rem; opacity: 0.6; }

#flipbook-wrapper {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

#book-container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.stf__parent {
  margin: 0 auto;
}

#controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(20, 20, 40, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 40px;
  padding: 8px 16px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: auto;
}

#controls.controls--hidden {
  opacity: 0;
  pointer-events: none;
}

.ctrl-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 50%;
  width: 36px; height: 36px;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.ctrl-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.4); }
.ctrl-btn:disabled { opacity: 0.3; cursor: default; }

#page-info {
  font-size: 0.85rem;
  opacity: 0.7;
  min-width: 80px;
  text-align: center;
}

#zoom-label {
  font-size: 0.8rem;
  opacity: 0.55;
  min-width: 36px;
  text-align: center;
}

#error-box {
  display: none;
  background: rgba(220,50,50,0.15);
  border: 1px solid rgba(220,50,50,0.4);
  border-radius: 10px;
  padding: 20px 28px;
  max-width: 420px;
  text-align: center;
  color: #fca5a5;
  line-height: 1.6;
  margin-top: 40px;
}

#error-box strong { display: block; margin-bottom: 6px; font-size: 1rem; }

@media (max-width: 600px) {
  #title-bar { font-size: 0.95rem; }
}

