:root {
  --red: #d7262e;
  --red-dark: #a91b22;
  --bg: #1b1d22;
  --bg-2: #262930;
  --text: #f3f1ec;
  --muted: #a6a9b0;
  --line: rgba(255, 255, 255, 0.1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at top, #2c2f37 0%, var(--bg) 60%);
  background-color: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }

.fb-app { display: flex; flex-direction: column; height: 100dvh; height: 100vh; }
@supports (height: 100dvh) { .fb-app { height: 100dvh; } }

/* Header */
.fb-top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.fb-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.fb-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(215, 38, 46, 0.25); }
.fb-brand b { font-size: 15px; letter-spacing: 0.2px; }
.fb-title { flex: 1; min-width: 0; text-align: center; }
.fb-title h1 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-title p { margin: 1px 0 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-cta {
  flex-shrink: 0; background: var(--red); border: 0; border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; text-decoration: none; color: #fff;
}
.fb-cta:hover { background: var(--red-dark); }

/* Stage */
.fb-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 14px 56px; }
.fb-book { width: 100%; height: 100%; }
.fb-page { background: #fff; overflow: hidden; }
.fb-page img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.fb-page .fb-loading-page { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #999; font-size: 13px; background: #faf9f6; }
.fb-side {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06); font-size: 20px; z-index: 5;
}
.fb-side:hover { background: rgba(255, 255, 255, 0.14); }
.fb-side.prev { left: 8px; }
.fb-side.next { right: 8px; }

/* End-of-book CTA page */
.fb-end { width: 100%; height: 100%; background: linear-gradient(160deg, #fff 0%, #fbeeee 100%); color: #222; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8%; gap: 10px; }
.fb-end .fb-dot { width: 26px; height: 26px; }
.fb-end h2 { margin: 6px 0 0; font-size: clamp(16px, 2.4vw, 24px); }
.fb-end p { margin: 0; font-size: clamp(12px, 1.5vw, 15px); color: #555; line-height: 1.5; }
.fb-end a { display: inline-block; margin-top: 6px; padding: 10px 18px; border-radius: 999px; background: #25d366; color: #fff; font-weight: 700; text-decoration: none; font-size: 14px; }
.fb-end a.call { background: var(--red); }
.fb-end button.form { margin-top: 6px; padding: 10px 18px; border-radius: 999px; border: 2px solid var(--red); background: #fff; color: var(--red); font-weight: 700; font-size: 14px; }
.fb-end small { color: #888; font-size: 11px; margin-top: 4px; }

/* Bottom bar */
.fb-bar {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.3);
}
.fb-btn { background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--text); white-space: nowrap; text-decoration: none; }
.fb-btn:hover { background: rgba(255, 255, 255, 0.1); }
.fb-btn.wa { background: #25d366; color: #fff; font-weight: 600; }
.fb-range { flex: 1; min-width: 60px; accent-color: var(--red); }
.fb-count { font-size: 13px; color: var(--muted); min-width: 74px; text-align: center; font-variant-numeric: tabular-nums; }

/* Overlays */
.fb-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 12, 0.96); display: none; }
.fb-overlay.open { display: block; }
.fb-zoom-scroll { position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; justify-content: center; }
.fb-zoom-scroll img { width: min(1400px, 200%); max-width: none; height: auto; margin: 56px 0 24px; background: #fff; }
.fb-close { position: fixed; top: 10px; right: 12px; z-index: 51; background: var(--red); border: 0; border-radius: 999px; padding: 8px 14px; color: #fff; font-weight: 600; }

.fb-splash { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; z-index: 4; text-align: center; padding: 16px; }
.fb-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--red); animation: fb-spin 0.9s linear infinite; }
@keyframes fb-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .fb-top { padding: 8px 12px; gap: 8px; }
  .fb-brand b { display: none; }
  .fb-cta { padding: 7px 11px; font-size: 12px; }
  .fb-stage { padding: 8px 8px; }
  .fb-side { display: none; }
  .fb-bar { gap: 2px; padding: 6px 8px; }
  .fb-btn { padding: 8px 7px; }
  .fb-btn .lbl { display: none; }
  .fb-count { min-width: 58px; font-size: 12px; }
}
