:root {
  --bar-h: 56px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: #eef4fb;
  background: #0a2a5e;
  background: radial-gradient(1200px 800px at 50% -10%, #17539f 0%, #0b3475 45%, #061c40 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ------------------------------------------------------------ bar --- */
.bar {
  flex: none;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: rgba(4, 20, 48, .55);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(8px);
}

.bar__brand {
  display: flex;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
}

.bar__brand img {
  height: 26px;
  width: auto;
  max-width: 100%;
  background: #eef4fb;
  padding: 4px 8px;
  border-radius: 6px;
}

.bar__nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  justify-content: flex-end;
}

.ctrl {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 9px;
  background: rgba(255, 255, 255, .07);
  color: #eef4fb;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, opacity .15s ease;
}

.ctrl svg { width: 20px; height: 20px; }
.ctrl:hover:not(:disabled) { background: rgba(255, 255, 255, .17); }
.ctrl:disabled { opacity: .35; cursor: default; }

.pager {
  min-width: 74px;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: #cfe0f5;
}

.pager b { font-weight: 600; color: #fff; }
.pager i { font-style: normal; opacity: .5; margin: 0 4px; }

/* penanda "Memuat n/44" saat halaman sisa masih dirender di belakang layar */
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 12.5px;
  color: #cfe0f5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chip[hidden] { display: none; }

/* ---------------------------------------------------------- stage --- */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px 14px;
}

.flipbook {
  filter: drop-shadow(0 22px 42px rgba(0, 0, 0, .45));
}

.flipbook[hidden] { display: none; }

/* --------------------------------------------------------- loader --- */
.loader {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: #cfe0f5;
}

.loader[hidden] { display: none; }

.loader__ring {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, .2);
  border-top-color: #ffb74d;
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader__text { margin: 0; font-size: 14.5px; }

.loader__bar {
  width: min(260px, 70vw);
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}

.loader__bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #f5811f, #ffc046);
  transition: width .2s ease;
}

/* ---------------------------------------------------------- error --- */
.error {
  text-align: center;
  max-width: 460px;
  color: #dbe7f7;
}

.error[hidden] { display: none; }
.error h2 { margin: 0 0 8px; font-size: 19px; }
.error p { margin: 0 0 16px; font-size: 14px; color: #a9c1e0; word-break: break-word; }
.error__link { color: #ffb74d; }

/* ----------------------------------------------------------- hint --- */
.hint {
  flex: none;
  margin: 0;
  padding: 0 14px 14px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(207, 224, 245, .6);
  transition: opacity .4s ease;
}

.hint.is-hidden { opacity: 0; }

/* page-flip (mode canvas) */
.stf__parent {
  position: relative;
  display: block;
  box-sizing: border-box;
  transform: translateZ(0);
  perspective: 2000px;
}

canvas.stf__canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
  .bar { gap: 8px; padding: 0 10px; }
  .bar__brand img { height: 22px; }
  .stage { padding: 10px 8px; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .loader__ring { animation-duration: 2s; }
}
