/* ===== Flipbook – edit colours here ===== */
:root {
  --fb-bg: #eef2f7;          /* page background behind the book */
  --fb-bar: #ffffff;         /* toolbar background */
  --fb-ink: #1f2933;         /* icon / text colour */
  --fb-accent: #1f63ad;      /* download button colour */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fb-bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--fb-ink);
}

#flipbook-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 420px;
  background: var(--fb-bg);
}

.fb-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 12px;
  overflow: hidden;
}

.fb-stage { min-height: 0; }

.fb-fit {
  width: 100%;
  margin: 0 auto;
}

.fb-book { margin: 0 auto; }

.fb-page {
  background: #fff;
  overflow: hidden;
}
.fb-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.fb-page:not(.is-ready)::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border: 3px solid rgba(0,0,0,.1);
  border-top-color: var(--fb-accent);
  border-radius: 50%;
  animation: fb-spin .8s linear infinite;
}

/* Loader */
.fb-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 15px;
  z-index: 5;
}
.fb-loader[hidden] { display: none; }
.fb-loader.is-error p { color: #b42318; max-width: 420px; text-align: center; line-height: 1.5; }
.fb-loader.is-error .fb-spinner { display: none; }
.fb-spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(0,0,0,.12);
  border-top-color: var(--fb-accent);
  border-radius: 50%;
  animation: fb-spin .8s linear infinite;
}
@keyframes fb-spin { to { transform: rotate(360deg); } }

/* Toolbar */
.fb-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 16px;
  padding: 6px 10px;
  background: var(--fb-bar);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  flex-wrap: wrap;
}
.fb-toolbar[hidden] { display: none; }

.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fb-ink);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
}
.fb-btn:hover { background: rgba(0,0,0,.06); }
.fb-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.fb-btn svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.fb-download {
  background: var(--fb-accent);
  color: #fff;
  padding: 0 14px;
  margin-left: 4px;
}
.fb-download:hover { background: var(--fb-accent); filter: brightness(1.1); }

.fb-counter {
  min-width: 70px;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.fb-sep { width: 1px; height: 22px; background: rgba(0,0,0,.12); margin: 0 4px; }

/* Full screen */
#flipbook-app:fullscreen { background: var(--fb-bg); }

/* Phones */
@media (max-width: 600px) {
  .fb-stage { padding: 12px 8px 8px; }
  .fb-download span { display: none; }
  .fb-download { padding: 0 10px; }
  #fb-first, #fb-last { display: none; }
}
