*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #0f172a; color: #e2e8f0;
  font-family: system-ui, -apple-system, sans-serif; overflow: hidden; }

.app { display: flex; flex-direction: column; height: 100%; }
/* 100dvh can mis-compute during native fullscreen transitions; 100% inherits correctly */
:fullscreen      .app { height: 100vh; }
:-webkit-full-screen .app { height: 100vh; }
:-moz-full-screen    .app { height: 100vh; }

/* ── Header ── */
.header { flex-shrink: 0; background: #1e293b; border-bottom: 1px solid #1e3a5f;
  padding: 11px 20px; display: flex; align-items: center; gap: 14px; }
.logo { height: 34px; width: auto; flex-shrink: 0; }
.hl { font-size: 1.1rem; font-weight: 700; color: #00c6b8; }
.hl span { color: #e2e8f0; font-weight: 300; }
.hs { font-size: .7rem; color: #64748b; margin-top: 1px; }

/* ── Viewer ── */
.viewer { flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; padding: 12px 52px; }

/* Book wrap — sized by JS */
#bookWrap { position: relative; display: flex; align-items: center;
  justify-content: center; will-change: transform;
  filter: contrast(1.12) saturate(1.06);
  transition: clip-path .35s ease, transform .35s ease; }

/* StPageFlip injects a canvas here — keep container clean */
#flipbook { display: block; }

/* StPageFlip canvas (dark theme background behind pages) */
#flipbook canvas { display: block; }

/* Loading overlay */
#loading { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: #0f172a;
  gap: 14px; font-size: .9rem; color: #94a3b8; z-index: 20; }
.spinner { width: 40px; height: 40px; border: 3px solid #1e3a5f;
  border-top-color: #00c6b8; border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Arrows ── */
.arrow { position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10; width: 40px; height: 40px;
  background: rgba(15,23,42,.85); border: 1px solid #1e3a5f;
  border-radius: 50%; cursor: pointer; color: #94a3b8;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  backdrop-filter: blur(6px); }
.arrow:hover { background: #1e293b; color: #00c6b8; border-color: #00c6b8; }
.arrow[disabled] { opacity: .2; pointer-events: none; }
.arrow-l { left: 6px; } .arrow-r { right: 6px; }
.arrow svg { width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ── Bottom ── */
.bottom { flex-shrink: 0; background: #1e293b; border-top: 1px solid #1e3a5f;
  padding: 7px 16px 9px; display: flex; flex-direction: column; gap: 7px; }
.ctrl-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.cb { background: none; border: none; cursor: pointer; color: #64748b;
  width: 30px; height: 30px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s; }
.cb:hover { color: #00c6b8; background: #0f172a; }
.cb[disabled] { opacity: .2; pointer-events: none; }
.cb svg { width: 19px; height: 19px; fill: currentColor; }
.counter { font-size: .8rem; color: #94a3b8; min-width: 72px; text-align: center; }
.vl { width: 1px; height: 16px; background: #1e3a5f; margin: 0 2px; }

/* Thumbnails */
.thumbs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.thumbs::-webkit-scrollbar { height: 3px; }
.thumbs::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }
.thumb { flex-shrink: 0; width: 44px; height: 44px; border-radius: 3px;
  overflow: hidden; cursor: pointer; border: 2px solid transparent; opacity: .45;
  transition: opacity .15s, border-color .15s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { opacity: .8; border-color: #00c6b8; }
.thumb.active { opacity: 1; border-color: #00c6b8; }

@media (max-width: 480px) {
  .viewer { padding: 8px 44px; }
  .thumb  { width: 36px; height: 36px; }
  .arrow  { width: 34px; height: 34px; }
  .arrow-l { left: 2px; } .arrow-r { right: 2px; }
}

/* Pantallas táctiles sin mouse (celular, tablet): sin flechas laterales, que le quitan
   ancho a la hoja; se pasa deslizando o con la barra inferior. MARGEN_LATERAL en app.js. */
@media (hover: none) and (pointer: coarse) {
  .arrow  { display: none; }
  .viewer { padding-left: 12px; padding-right: 12px; }
}

/* Landscape on small screens: hide thumbnails to maximise book area */
@media (max-height: 500px) {
  .thumbs  { display: none; }
  .bottom  { padding-top: 4px; padding-bottom: 5px; gap: 0; }
  .viewer  { padding-top: 4px; padding-bottom: 4px; }
}

/* ── Agregado para epayco.com ── */
.header { justify-content: space-between; }
.dl { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px solid #334155; border-radius: 999px; color: #e2e8f0;
  font-size: .82rem; font-weight: 600; text-decoration: none;
  transition: border-color .15s, color .15s; }
.dl:hover, .dl:focus-visible { border-color: #00c6b8; color: #00c6b8; }
.dl svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.logo-link { display: inline-flex; flex-shrink: 0; border-radius: 4px; }
.thumb:focus-visible, .cb:focus-visible, .arrow:focus-visible, .logo-link:focus-visible {
  outline: 2px solid #00c6b8; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 480px) {
  .header { padding: 9px 14px; }
  .logo { height: 28px; }
  .dl { padding: 7px 11px; font-size: .78rem; }
}
.thumb { padding: 0; background: none; }
