/* Kideotainment Flipbook engine: styles. Colours come from the book JSON "theme" (CSS variables below). */
.kfb {
  --kfb-bg: #4a1080; --kfb-bg2: #31025b; --kfb-accent: #fcd000; --kfb-accent-text: #31025b;
  --kfb-text: #fff; --kfb-paper: #f6ecd2; --kfb-ratio: 1/1;
  position: relative; overflow: hidden; user-select: none; -webkit-user-select: none;
  background: linear-gradient(to bottom, var(--kfb-bg), var(--kfb-bg2));
  color: var(--kfb-text); border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
  -webkit-tap-highlight-color: transparent;
}
.kfb *, .kfb *::before, .kfb *::after { box-sizing: border-box; }
:where(.kfb) button { font: inherit; color: inherit; border: 0; cursor: pointer; background: none; }
.kfb svg { width: 20px; height: 20px; flex: none; }

.kfb-stage { position: relative; padding: 12px 12px 0; }
.kfb-bookwrap { position: relative; margin: 0 auto; width: 100%; }
.kfb-book { opacity: 0; transition: opacity .3s; }
.kfb--ready .kfb-book { opacity: 1; }
.kfb-book:not(.stf__parent) .kfb-page { display: none; }
.kfb-placeholder { display: block; width: 100%; max-width: 540px;
  max-width: min(540px, calc((100vh - 120px) * var(--kfb-ratio))); max-width: min(540px, calc((100svh - 120px) * var(--kfb-ratio))); height: auto; margin: 0 auto; aspect-ratio: var(--kfb-ratio); }

.kfb-page { background: var(--kfb-paper); overflow: hidden; }
.kfb-page img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; user-select: none; }
/* soft paper shading toward the spine, so the open book reads as a real book */
.kfb--landscape .kfb-page.--left::after,
.kfb--landscape .kfb-page.--right::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.kfb--landscape .kfb-page.--left::after { background: linear-gradient(to left, rgba(0,0,0,.22), rgba(0,0,0,.06) 6%, rgba(0,0,0,0) 14%); }
.kfb--landscape .kfb-page.--right::after { background: linear-gradient(to right, rgba(0,0,0,.22), rgba(0,0,0,.06) 6%, rgba(0,0,0,0) 14%); }
.kfb .stf__block { filter: drop-shadow(0 10px 18px rgba(0,0,0,.35)); }

.kfb-arrow {
  position: absolute; top: 50%; z-index: 20; transform: translateY(-50%);
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0,0,0,.3); transition: opacity .2s, transform .15s;
}
.kfb-arrow svg { width: 24px; height: 24px; }
.kfb-arrow:active { transform: translateY(-50%) scale(.94); }
.kfb-prev { left: 4px; background: rgba(255,255,255,.9); color: var(--kfb-accent-text); }
.kfb-next { right: 4px; background: var(--kfb-accent); color: var(--kfb-accent-text); }
.kfb-arrow:disabled { opacity: 0; pointer-events: none; }

.kfb-controls { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 12px; }
.kfb-play {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: var(--kfb-accent) !important; color: var(--kfb-accent-text) !important; font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.kfb-play:hover { background: #fff !important; }
.kfb-restart {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: #fff !important; color: var(--kfb-accent-text) !important; font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.kfb-restart:hover { background: var(--kfb-accent) !important; }
.kfb-restart-ico svg { width: 18px; height: 18px; }
.kfb-count { min-width: 4.5rem; text-align: center; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; opacity: .9; }
.kfb-round { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: rgba(255,255,255,.15) !important; }
.kfb-round:hover, .kfb-pill:hover { background: rgba(255,255,255,.25) !important; }
.kfb-pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 999px; background: rgba(255,255,255,.15) !important; font-size: 14px; font-weight: 700 !important; }

.kfb-menu {
  position: absolute; bottom: 100%; left: 50%; z-index: 30; transform: translateX(-50%); margin-bottom: 4px;
  width: 224px; overflow: hidden; border-radius: 16px; background: #fff; color: var(--kfb-bg2);
  box-shadow: 0 20px 40px rgba(0,0,0,.3); font-size: 14px; font-weight: 700; text-align: left;
}
.kfb-menu[hidden] { display: none; }
.kfb-menu a, .kfb-menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 12px 16px; color: var(--kfb-bg2) !important; text-decoration: none; text-align: left; }
.kfb-menu a:hover, .kfb-menu button:hover { background: #f3f5f6; }
.kfb-wa svg { color: #25d366; }

.kfb--full { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; justify-content: center; border-radius: 0; }
.kfb--full .kfb-stage { flex: 1; min-height: 0; display: flex; align-items: center; }

@media (min-width: 640px) {
  .kfb-stage { padding: 24px 56px 0; }
  .kfb-prev { left: 8px; } .kfb-next { right: 8px; }
  .kfb-controls { gap: 12px; padding: 16px 12px; }
}

.kfb-toast {
  position: fixed; left: 0; right: 0; bottom: 24px; z-index: 120; margin: 0 auto; width: fit-content; max-width: 90%;
  padding: 8px 16px; border-radius: 999px; background: rgba(11,18,32,.9); color: #fff;
  font-size: 14px; font-weight: 700; text-align: center; box-shadow: 0 6px 18px rgba(0,0,0,.3);
  pointer-events: none; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.kfb-toast--show { opacity: 1; transform: none; }

@keyframes kfb-pulse { 0% { box-shadow: 0 0 0 0 rgba(252,208,0,.9); } 100% { box-shadow: 0 0 0 18px rgba(252,208,0,0); } }
.kfb-pulse { animation: kfb-pulse 1.2s ease-out 2; }
@media (prefers-reduced-motion: reduce) { .kfb-pulse { animation: none; } }

/* Phones turned sideways: trim padding so the two-page spread is as big as the screen allows. */
@media (orientation: landscape) and (max-height: 540px) {
  .kfb-stage { padding: 6px 48px 0; }
  .kfb-controls { padding: 6px 12px; gap: 10px; }
}

/* "Turn your phone sideways" tip: phones held upright only. */
.kfb-rotate { display: none; align-items: center; gap: 8px; padding: 8px 8px 0 12px; font-size: 13px; font-weight: 700; line-height: 1.3; opacity: .92; }
.kfb-rotate svg { width: 22px; height: 22px; color: var(--kfb-accent); animation: kfb-tilt 2.4s ease-in-out infinite; }
.kfb-rotate span { flex: 1; }
.kfb-rotate-x { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; font-size: 18px !important; line-height: 1; opacity: .8; }
@media (orientation: portrait) and (max-width: 600px) { .kfb-rotate { display: flex; } }
.kfb--full .kfb-rotate { display: none; }
@keyframes kfb-tilt { 0%, 55%, 100% { transform: rotate(0); } 70%, 90% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .kfb-rotate svg { animation: none; } }
