/* ==========================================================================
   Reader flipbook — 3D page turn, magazine slide, book spread
   ========================================================================== */

:root {
  --fb-bg: #1b1a19;
  --fb-bg-2: #2a2725;
  --fb-bar: 58px;
  --fb-accent: #e05a3c;
  --fb-fg: #f4f1ec;
  --fb-muted: #a29a92;
  --fb-glass: rgba(28, 26, 24, 0.82);
  --fb-line: rgba(255, 255, 255, 0.12);
  --fb-radius: 10px;
  --fb-page-shadow: 0 2px 10px rgba(0, 0, 0, 0.28), 0 16px 44px rgba(0, 0, 0, 0.2);
  --fb-turn-ms: 780ms;
  --fb-slide-ms: 520ms;
  --fb-ease: cubic-bezier(0.42, 0, 0.28, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body.fb-body {
  background: var(--fb-bg);
  color: var(--fb-fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

.fb {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Latar ---------- */
.fb-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 65% at 85% 12%, rgba(76, 26, 122, 0.28) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 12% 55%, rgba(195, 130, 32, 0.14) 0%, transparent 55%),
    radial-gradient(120% 90% at 50% 0%, var(--fb-bg-2) 0%, var(--fb-bg) 62%),
    var(--fb-bg);
  z-index: 0;
}

.fb-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- Panggung ---------- */
.fb-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  z-index: 1;
}

.fb-viewport {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 56px 14px 12px;
  -webkit-overflow-scrolling: touch;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.fb-viewport.is-turning {
  cursor: grabbing;
}

.fb-sizer {
  position: relative;
  flex: 0 0 auto;
}

/* Catatan: JANGAN beri transform-style: preserve-3d pada .fb-zoom.
   Bayangan .fb-cast dan halaman buku sebidang (z = 0) dan akan
   z-fighting. Perspektif untuk lembar yang dibalik dipasang langsung
   pada elemen .fb-flip2 lewat JavaScript. */
.fb-zoom {
  position: absolute;
  top: 0;
  left: 0;
  perspective: 1800px;
  perspective-origin: 50% 45%;
}

/* ---------- Buku ---------- */
.fb-book {
  position: relative;
  display: flex;
  transform-style: preserve-3d;
}

.fb-page {
  position: relative;
  overflow: hidden;
  background: #fff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--fb-page-shadow);
  transform: translateZ(0);
}

.fb-page.is-blank {
  background: #efece7;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.fb-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  opacity: 0;
  transition: opacity 220ms ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.fb-page.is-ready .fb-media {
  opacity: 1;
}

/* Pemuat per halaman: shimmer dipasang di background halaman sendiri
   (bukan pseudo-element) supaya tidak bentrok dengan gradien punggung
   buku di .is-left::after / .is-right::before. .fb-media transparan
   (opacity 0) sampai halaman siap. */
.fb-page:not(.is-ready):not(.is-blank) {
  background:
    linear-gradient(100deg, transparent 20%, rgba(0, 0, 0, 0.05) 42%, transparent 64%) 0 0 / 280% 100%,
    #f3f1ee;
  animation: fb-shimmer 1.15s linear infinite;
}

@keyframes fb-shimmer {
  from {
    background-position: 130% 0, 0 0;
  }
  to {
    background-position: -30% 0, 0 0;
  }
}

/* Tepi halaman — sangat tipis supaya kertas tampak bersih. */
.fb-page::before,
.fb-page::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  z-index: 3;
}

.fb-page.is-left::before,
.fb-page.is-single::before {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0));
}

.fb-page.is-right::after,
.fb-page.is-single::after {
  right: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0));
}

/* Lipatan tengah: gradien gelap tipis di sisi punggung tiap halaman,
   bukan pita lebar. */
.fb-page.is-left::after,
.fb-page.is-right::before {
  width: 6%;
}

.fb-page.is-left::after {
  right: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.11));
}

.fb-page.is-right::before {
  left: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.11));
}

.fb-book.is-magazine .fb-page::before,
.fb-book.is-magazine .fb-page::after {
  opacity: 0.55;
}

/* ---------- Halaman yang sedang dibalik (rantai strip) ----------
   JANGAN pakai isolation: isolate / overflow / opacity < 1 / filter di
   sini atau di strip: semuanya memaksa transform-style menjadi flat dan
   mematikan pengurutan kedalaman 3D antar strip. */
.fb-flip2 {
  position: absolute;
  top: 0;
  z-index: 6;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.fb-flip-strip {
  position: absolute;
  top: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
  box-shadow: none;
  overflow: visible;
}

.fb-flip-face {
  position: absolute;
  inset: 0;
  background: #fff;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  overflow: visible;
}

.fb-flip-side {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: #fff;
  background-repeat: no-repeat;
  user-select: none;
  -webkit-user-select: none;
}

.fb-flip-side.is-front {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.fb-flip-side.is-back {
  transform: rotateY(180deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.fb-flip-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  z-index: 3;
  pointer-events: none;
}

.fb-flip-edge.is-left {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0));
}

.fb-flip-edge.is-right {
  right: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0));
}

/* Bayangan punggung buku pada strip engsel: lebar piksel, di sisi engsel. */
.fb-flip-edge.is-spine {
  width: 18px;
}

.fb-flip-edge.is-spine.is-at-left {
  left: 0;
  right: auto;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0));
}

.fb-flip-edge.is-spine.is-at-right {
  right: 0;
  left: auto;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0));
}

.fb-flip2.is-mode-mag .fb-flip-edge {
  opacity: 0.55;
}

.fb-flip-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  will-change: opacity, background;
}

.fb-cast {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* Tepi tumpukan kertas — ketebalan halaman di sisi luar buku. */
.fb-depth {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: var(--fb-depth, 6px);
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.4),
      rgba(0, 0, 0, 0) 16%,
      rgba(0, 0, 0, 0) 76%,
      rgba(0, 0, 0, 0.5)
    ),
    repeating-linear-gradient(
      to right,
      rgba(0, 0, 0, 0.12) 0 1px,
      rgba(255, 255, 255, 0.96) 1px 2.5px
    );
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.fb-depth-l {
  left: calc(-1 * var(--fb-depth, 6px));
  border-radius: 3px 0 0 3px;
}

.fb-depth-r {
  right: calc(-1 * var(--fb-depth, 6px));
  border-radius: 0 3px 3px 0;
}

/* ---------- Panah navigasi ---------- */
.fb-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 15%;
  min-width: 56px;
  z-index: 7;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 200ms ease;
  display: grid;
  place-items: center;
}

.fb-arrow::before {
  content: "";
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--fb-glass);
  border: 1px solid var(--fb-line);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.fb-arrow::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border-top: 2px solid var(--fb-fg);
  border-right: 2px solid var(--fb-fg);
}

.fb-arrow-prev {
  left: 0;
}

.fb-arrow-prev::after {
  transform: translateX(-4px) rotate(-135deg);
}

.fb-arrow-next {
  right: 0;
}

.fb-arrow-next::after {
  transform: translateX(4px) rotate(45deg);
}

.fb-stage:hover .fb-arrow:not([hidden]) {
  opacity: 1;
}

.fb-arrow:disabled {
  cursor: default;
  opacity: 0 !important;
}

.fb-arrow:focus-visible {
  opacity: 1;
  outline: 2px solid var(--fb-accent);
  outline-offset: -6px;
  border-radius: 10px;
}

/* ---------- Bilah atas ---------- */
.fb-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  transition: opacity 200ms ease, transform 200ms ease;
}

.fb.is-idle .fb-topbar {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.fb-topbar a,
.fb-topbar button,
.fb-topbar .fb-title {
  color: var(--fb-fg);
}

.fb-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--fb-glass);
  border: 1px solid var(--fb-line);
  transition: background 160ms ease;
}

.fb-back:hover {
  background: rgba(48, 45, 42, 0.92);
}

.fb-title {
  min-width: 0;
  margin-left: 2px;
}

.fb-title strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-title span {
  display: block;
  font-size: 12px;
  color: var(--fb-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Bilah bawah ---------- */
.fb-toolbar {
  flex: 0 0 auto;
  height: var(--fb-bar);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px calc(0px + env(safe-area-inset-bottom, 0px));
  background: var(--fb-glass);
  border-top: 1px solid var(--fb-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 220ms ease;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fb-toolbar::-webkit-scrollbar {
  display: none;
}

.fb.is-idle .fb-toolbar {
  opacity: 0;
  pointer-events: none;
}

.fb-btn {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--fb-fg);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.fb-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.fb-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.fb-btn.is-active {
  background: rgba(224, 90, 60, 0.22);
  border-color: rgba(224, 90, 60, 0.55);
}

.fb-btn:focus-visible {
  outline: 2px solid var(--fb-accent);
  outline-offset: 1px;
}

.fb-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fb-btn > span {
  display: grid;
  place-items: center;
}

/* Ikon tombol mode ikut berganti mengikuti mode aktif */
.fb-btn .fb-ic-book {
  display: none;
}

.fb[data-mode="book"] .fb-btn .fb-ic-mag {
  display: none;
}

.fb[data-mode="book"] .fb-btn .fb-ic-book {
  display: grid;
}

.fb-sep {
  flex: 0 0 auto;
  width: 1px;
  height: 24px;
  background: var(--fb-line);
}

.fb-spacer {
  flex: 1 1 auto;
}

/* Kontrol halaman */
.fb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.fb-range {
  flex: 1 1 auto;
  min-width: 60px;
  height: 20px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.fb-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--fb-accent) 0 var(--fb-fill, 0%),
    rgba(255, 255, 255, 0.2) var(--fb-fill, 0%) 100%
  );
}

.fb-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--fb-accent) 0 var(--fb-fill, 0%),
    rgba(255, 255, 255, 0.2) var(--fb-fill, 0%) 100%
  );
}

.fb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.fb-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.fb-range:focus-visible {
  outline: 2px solid var(--fb-accent);
  outline-offset: 4px;
  border-radius: 999px;
}

.fb-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--fb-muted);
  white-space: nowrap;
}

.fb-count b {
  color: var(--fb-fg);
  font-weight: 600;
}

/* ---------- Panel thumbnail ---------- */
.fb-thumbs {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 232px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  background: var(--fb-glass);
  border-right: 1px solid var(--fb-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateX(-100%);
  transition: transform 260ms var(--fb-ease);
}

.fb-thumbs.is-open {
  transform: translateX(0);
  box-shadow: 18px 0 46px rgba(0, 0, 0, 0.5);
}

.fb-thumbs-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 46px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--fb-line);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fb-muted);
}

.fb-thumbs-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.fb-thumb {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--fb-line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
  transition: border-color 150ms ease, transform 150ms ease;
}

.fb-thumb:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.45);
}

.fb-thumb.is-current {
  border-color: var(--fb-accent);
  box-shadow: 0 0 0 2px rgba(224, 90, 60, 0.4);
}

.fb-thumb img,
.fb-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
}

.fb-thumb i {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font: 600 10px/1.5 system-ui, sans-serif;
  font-style: normal;
  text-align: center;
}

.fb-thumb.is-loading {
  min-height: 120px;
  background: #eceae7;
}

.fb-scrim {
  position: absolute;
  inset: 0;
  z-index: 11;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.fb-scrim.is-on {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Modal ---------- */
.fb-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 9, 8, 0.7);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.fb-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.fb-modal-card {
  width: min(420px, 100%);
  border-radius: 14px;
  background: #221f1d;
  border: 1px solid var(--fb-line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  transition: transform 200ms var(--fb-ease);
}

.fb-modal.is-open .fb-modal-card {
  transform: none;
}

.fb-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 12px 14px 18px;
  border-bottom: 1px solid var(--fb-line);
}

.fb-modal-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.fb-modal-body {
  padding: 18px;
}

.fb-share-row {
  display: flex;
  gap: 8px;
}

.fb-share-row input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  color: var(--fb-fg);
  background: #171514;
  border: 1px solid var(--fb-line);
  border-radius: 8px;
  font: 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.fb-share-row input:focus {
  outline: none;
  border-color: var(--fb-accent);
}

.fb-copy {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 16px;
  color: #fff;
  background: var(--fb-accent);
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.fb-copy:hover {
  filter: brightness(1.08);
}

.fb-copy.is-done {
  background: #2e9e63;
}

.fb-share-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--fb-muted);
}

.fb-share-links {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.fb-share-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--fb-line);
  color: var(--fb-fg);
  text-decoration: none;
  font-size: 12.5px;
}

.fb-share-links a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.fb-share-links svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ---------- Pemuat ---------- */
.fb-loader {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: rgba(20, 18, 17, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.fb-loader.is-on {
  opacity: 1;
  pointer-events: auto;
}

.fb-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--fb-accent);
  animation: fb-spin 720ms linear infinite;
}

@keyframes fb-spin {
  to {
    transform: rotate(360deg);
  }
}

.fb-loader p {
  margin: 0;
  font-size: 13px;
  color: var(--fb-muted);
}

/* ---------- Pesan ---------- */
.fb-message {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.fb-message[hidden] {
  display: none !important;
}

.fb-message h2 {
  margin: 0;
  font-size: 18px;
}

.fb-message p {
  margin: 0;
  max-width: 42ch;
  color: var(--fb-muted);
  font-size: 13.5px;
}

.fb-message a {
  color: var(--fb-fg);
}

/* ---------- Responsif ---------- */
@media (max-width: 720px) {
  :root {
    --fb-bar: 52px;
  }

  .fb-viewport {
    padding: 48px 8px 8px;
  }

  .fb-topbar {
    height: 46px;
    padding: 0 8px;
  }

  .fb-topbar .fb-title span {
    display: none;
  }

  .fb-thumbs {
    width: min(78vw, 260px);
  }

  .fb-thumbs-body {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fb-arrow {
    display: none;
  }

  .fb-hide-sm {
    display: none !important;
  }

  .fb-count {
    font-size: 12px;
  }
}

/* Bilah perkakas rapat supaya tidak meluber di layar sempit */
@media (max-width: 560px) {
  .fb-toolbar {
    gap: 4px;
    padding: 0 6px;
  }

  .fb-btn {
    width: 34px;
    height: 34px;
    border-radius: 7px;
  }

  .fb-btn svg {
    width: 18px;
    height: 18px;
  }

  .fb-sep {
    display: none;
  }

  .fb-range {
    min-width: 34px;
  }

  .fb-count {
    font-size: 11.5px;
  }
}

@media (max-width: 430px) {
  #fbBtnFirst,
  #fbBtnLast {
    display: none;
  }

  .fb-btn {
    width: 32px;
    height: 32px;
  }

  .fb-topbar .fb-back span {
    display: none;
  }

  .fb-back {
    padding: 7px 9px;
  }
}

@media (max-width: 380px) {
  #fbBtnFull {
    display: none;
  }
}

@media (max-width: 340px) {
  #fbBtnShare {
    display: none;
  }
}

@media (max-width: 460px) {
  .fb-count .fb-total {
    display: none;
  }
}

/* Layar pendek (landscape ponsel): kurangi sisipan vertikal */
@media (max-height: 460px) {
  .fb-viewport {
    padding-top: 42px;
    padding-bottom: 6px;
  }
}

/* Reduce-motion DIBATASI ke elemen UI non-flip. Animasi flip dikendalikan
 * JavaScript (requestAnimationFrame) dan sengaja tidak ikut dipangkas. */
@media (prefers-reduced-motion: reduce) {
  .fb-spinner,
  .fb-page:not(.is-ready) {
    animation: none !important;
  }

  .fb-arrow,
  .fb-media,
  .fb-topbar,
  .fb-toolbar,
  .fb-thumbs,
  .fb-scrim,
  .fb-modal,
  .fb-modal-card,
  .fb-btn,
  .fb-thumb {
    transition-duration: 0.01ms !important;
  }
}