.mcfb-root {
  --mcfb-page-w: 430px;
  --mcfb-page-h: 640px;
  --mcfb-blue: #061c78;
  --mcfb-green: #63c719;
  --mcfb-bg: #0b1225;
  --mcfb-flip-duration: 1700ms;
  width: 100%;
  max-width: calc((var(--mcfb-page-w) * 2) + 160px);
  margin: 0 auto;
  font-family: inherit;
  color: #fff;
}

.mcfb-root[data-mode="single"] {
  max-width: calc(var(--mcfb-page-w) + 160px);
}

.mcfb-root * {
  box-sizing: border-box;
}

.mcfb-shell {
  background:
    radial-gradient(circle at 30% 20%, rgba(72, 129, 255, 0.30), transparent 30%),
    linear-gradient(145deg, #03134f, #07102d 55%, #020716);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.30);
  overflow: hidden;
}

.mcfb-root.is-zoomed .mcfb-shell {
  overflow-x: auto;
  padding-bottom: 28px;
}

.mcfb-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.mcfb-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}

.mcfb-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mcfb-page-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.mcfb-page-input {
  width: 60px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  padding: 4px 8px;
}

.mcfb-page-count {
  color: rgba(255, 255, 255, 0.70);
  font-size: 13px;
}

.mcfb-tool,
.mcfb-arrow {
  border: 0;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transition: transform 180ms ease, background 180ms ease, opacity 180ms ease;
}

.mcfb-tool:hover,
.mcfb-arrow:hover {
  background: rgba(99, 199, 25, 0.85);
}

.mcfb-tool:active,
.mcfb-arrow:active {
  transform: scale(0.96);
}

.mcfb-tool {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.mcfb-view {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mcfb-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 34px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.mcfb-arrow:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  transform: none;
}

.mcfb-book-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(100%, calc(var(--mcfb-page-w) * 2));
  min-height: min(76vh, var(--mcfb-page-h));
  overflow: visible;
  transform-origin: top center;
  transition: transform 240ms ease;
}

.mcfb-root[data-mode="single"] .mcfb-book-wrap,
.mcfb-root.is-single .mcfb-book-wrap {
  width: min(100%, var(--mcfb-page-w));
}

.mcfb-root.is-zoomed .mcfb-book-wrap {
  transform: scale(1.18);
  margin: 0 auto 72px;
}

.mcfb-book {
  position: relative;
  width: 100%;
  height: min(76vh, var(--mcfb-page-h));
  max-width: calc(var(--mcfb-page-w) * 2);
  max-height: var(--mcfb-page-h);
  min-height: 320px;
  background: transparent;
  overflow: hidden;
  isolation: isolate;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.mcfb-root[data-mode="single"] .mcfb-book,
.mcfb-root.is-single .mcfb-book {
  max-width: var(--mcfb-page-w);
}

.mcfb-book-wrap::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -18px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.36);
  filter: blur(12px);
  opacity: 0.76;
  pointer-events: none;
  z-index: 0;
}

.mcfb-st-page {
  position: relative;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,.20);
}

.mcfb-st-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.12), transparent 12%, transparent 88%, rgba(0,0,0,0.10));
  opacity: .55;
}

.mcfb-st-page.--left::before {
  background: linear-gradient(90deg, transparent 82%, rgba(0,0,0,.18));
}

.mcfb-st-page.--right::before {
  background: linear-gradient(90deg, rgba(0,0,0,.16), transparent 18%);
}

.mcfb-st-page img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  margin: 0;
}

.mcfb-root[data-fit="contain"] .mcfb-st-page img {
  object-fit: contain;
  background: #fff;
}

/*
 * PageFlip keeps the next/previous page as a bottom layer during the turn.
 * Those layers must be clipped by the book canvas. If these wrappers are visible,
 * the upcoming page can leak below the right page and create a flicker.
 */
.mcfb-book .stf__parent,
.mcfb-book .stf__wrapper,
.mcfb-book .stf__block {
  overflow: hidden !important;
}

.mcfb-book .stf__item {
  overflow: hidden !important;
  background: #fff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, clip-path;
}

.mcfb-book canvas {
  pointer-events: none;
}

.mcfb-book .stf__outerShadow,
.mcfb-book .stf__innerShadow,
.mcfb-book .stf__hardShadow,
.mcfb-book .stf__hardInnerShadow {
  pointer-events: none;
}

.mcfb-root.is-turning .mcfb-book-wrap {
  cursor: grabbing;
}

.mcfb-status {
  min-height: 18px;
  margin-top: 10px;
  text-align: center;
  color: rgba(255,255,255,.78);
  font-size: 13px;
}

.mcfb-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding: 8px 2px 4px;
  scrollbar-width: thin;
}

.mcfb-thumbs.is-hidden {
  display: none;
}

.mcfb-thumb {
  width: 52px;
  height: 72px;
  padding: 0;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,.18);
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  opacity: .68;
  transition: opacity 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.mcfb-thumb:hover,
.mcfb-thumb.is-active {
  opacity: 1;
  border-color: var(--mcfb-green);
  transform: translateY(-2px);
}

.mcfb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mcfb-root[data-fit="contain"] .mcfb-thumb img {
  object-fit: contain;
}

.mcfb-error,
.mcfb-engine-missing .mcfb-shell::before {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff3cd;
  color: #664d03;
}

.mcfb-engine-missing .mcfb-shell::before {
  content: "MaxClean Flipbook: no se pudo cargar el motor de página.";
  margin-bottom: 12px;
}

@media (max-width: 760px) {
  .mcfb-root {
    max-width: 100%;
  }

  .mcfb-shell {
    padding: 12px;
    border-radius: 14px;
  }

  .mcfb-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .mcfb-tools {
    justify-content: flex-start;
  }

  .mcfb-view {
    gap: 7px;
  }

  .mcfb-arrow {
    width: 34px;
    height: 34px;
    font-size: 28px;
  }

  .mcfb-book-wrap,
  .mcfb-root[data-mode="single"] .mcfb-book-wrap,
  .mcfb-root.is-single .mcfb-book-wrap {
    width: min(100%, var(--mcfb-page-w));
  }

  .mcfb-root.is-zoomed .mcfb-book-wrap {
    transform: scale(1.08);
  }

  .mcfb-thumb {
    width: 46px;
    height: 64px;
  }
}

/* Forward-only underlay: covers the old right page during next-page turns.
 * The PageFlip engine already animates the fold; this layer only prevents the
 * stale right-side image from staying visible until the animation callback ends.
 */
.mcfb-forward-underlay {
  position: absolute;
  display: none;
  overflow: hidden;
  pointer-events: none;
  background: #fff;
  z-index: 12;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mcfb-forward-underlay.is-visible {
  display: block;
}

.mcfb-forward-underlay img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.mcfb-root[data-fit="contain"] .mcfb-forward-underlay img {
  object-fit: contain;
  background: #fff;
}

.mcfb-forward-underlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.16), transparent 18%);
  opacity: .55;
}
