:root {
  --ink: #151b23;
  --panel: #1c242f;
  --panel-2: #243040;
  --line: rgba(242, 236, 223, 0.1);
  --cream: #f2ecdf;
  --muted: #9aa4b2;
  --accent: #f05a28;
  --accent-dark: #d0481c;
  --wa: #25d366;
  --side: 288px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink);
  color: var(--cream);
  font: 14px/1.4 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; display: block; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: flex; height: 100vh; height: 100dvh; }

/* ---------- Sidebar (desktop) ---------- */
.side {
  width: var(--side);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.brand { padding: 22px 22px 6px; }
.brand img { height: 44px; width: auto; }
.side-title {
  margin: 10px 22px 12px;
  font: 600 12px/1 Oswald, sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.cats { position: relative; flex: 1; overflow-y: auto; padding: 0 12px 12px; scrollbar-width: thin; scrollbar-color: var(--panel-2) transparent; }
.cat {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px; margin-bottom: 2px;
  border-radius: 10px; text-align: left;
  transition: background .15s;
}
.cat:hover { background: var(--panel-2); }
.cat img {
  width: 64px; height: 45px; object-fit: cover; flex: none;
  border-radius: 5px; background: var(--ink);
  outline: 1px solid var(--line);
}
.cat-txt { min-width: 0; flex: 1; }
.cat-name { display: block; font: 600 15px/1.15 Oswald, sans-serif; letter-spacing: .02em; text-transform: uppercase; }
.cat-sub { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-pg { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.cat.on { background: rgba(240, 90, 40, .14); box-shadow: inset 3px 0 0 var(--accent); }
.cat.on .cat-name { color: var(--accent); }
.cat.on img { outline-color: var(--accent); }

.side-foot { padding: 14px 16px 18px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; border-radius: 10px; font-weight: 600;
  transition: background .15s, transform .15s;
}
.btn:active { transform: scale(.98); }
.btn-wa { background: var(--wa); color: #06331a; }
.btn-wa svg { fill: currentColor; }
.btn-wa:hover { background: #2fe072; }
.btn-ghost { border: 1px solid var(--line); color: var(--cream); font-weight: 500; font-size: 13px; }
.btn-ghost:hover { background: var(--panel-2); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 20px; flex: none;
  border-bottom: 1px solid var(--line);
}
.brand-m { display: none; }
.now { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.now-cat { font: 600 20px/1 Oswald, sans-serif; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-page { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tools { display: flex; gap: 4px; }
.ic {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; color: var(--cream);
  transition: background .15s;
}
.ic:hover { background: var(--panel-2); }
.ic-wa { color: var(--wa); }
#btnSound .snd-off, #btnSound.muted .snd-on { display: none; }
#btnSound.muted .snd-off { display: block; }
#btnSound.muted { color: var(--muted); }
.show-m { display: none; }

.chips { display: none; }

/* ---------- Stage / book ---------- */
.stage { position: relative; flex: 1; min-height: 0; padding: 24px 72px; }
.book-wrap { position: relative; width: 100%; height: 100%; }
.book { width: 100%; height: 100%; cursor: pointer; touch-action: pan-y; }
/* page-flip letak min-width = minWidth (10000) pada parent — batalkan, kita guna minWidth hanya untuk paksa mod satu page */
.book.stf__parent { min-width: 0 !important; min-height: 0 !important; }
.page { background: #0d1117; overflow: hidden; }
.page img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.page::after { /* shimmer sementara gambar belum load */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.04) 50%, transparent 70%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.page.loaded::after { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
.stf__parent { margin: 0 auto; }
.stf__block { filter: drop-shadow(0 18px 40px rgba(0,0,0,.45)); }

.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line);
  transition: background .15s, opacity .15s;
  z-index: 5;
}
.nav:hover { background: var(--accent); border-color: var(--accent); }
.nav[disabled] { opacity: .25; pointer-events: none; }
.nav-prev { left: 14px; }
.nav-next { right: 14px; }

/* ---------- Bottom bar ---------- */
.bar { flex: none; border-top: 1px solid var(--line); }
.progress { display: flex; height: 4px; gap: 2px; }
.progress span { background: var(--panel-2); cursor: pointer; transition: background .2s; }
.progress span.on { background: var(--accent); }
.progress span.done { background: rgba(240, 90, 40, .4); }
.bar-row { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; }
.jump { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.jump input {
  width: 52px; height: 32px; text-align: center;
  background: var(--panel); color: var(--cream);
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.jump input::-webkit-inner-spin-button, .jump input::-webkit-outer-spin-button { -webkit-appearance: none; }
.bar #btnZoom { position: absolute; right: 16px; }
.bar-row { position: relative; }

/* ---------- Zoom ---------- */
.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(8, 11, 15, .96); }
.zoom[hidden] { display: none; }
.zoom-scroll { position: absolute; inset: 0; overflow: auto; display: grid; touch-action: pan-x pan-y pinch-zoom; }
.zoom-scroll img { display: block; width: 100%; max-width: none; margin: auto; cursor: zoom-in; }
.zoom-scroll.big img { width: 200%; cursor: zoom-out; }
.zoom-close {
  position: fixed; top: 14px; right: 14px;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
}
.zoom-hint {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  margin: 0; padding: 6px 12px; border-radius: 99px;
  background: var(--panel); color: var(--muted); font-size: 12px; white-space: nowrap;
  pointer-events: none;
}

.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translate(-50%, 20px);
  padding: 10px 16px; border-radius: 10px;
  background: var(--cream); color: var(--ink); font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tablet / phone ---------- */
@media (max-width: 900px) {
  .side { display: none; }
  .top { height: 56px; padding: 0 8px 0 14px; }
  .brand-m { display: block; flex: none; }
  .brand-m img { height: 28px; width: auto; }
  .now { flex-direction: column; gap: 2px; align-items: flex-start; }
  .now-cat { font-size: 16px; max-width: 100%; }
  .now-page { font-size: 12px; }
  .hide-m { display: none; }
  .show-m { display: grid; }

  .chips {
    position: relative; display: flex; gap: 8px; flex: none;
    padding: 10px 16px; overflow-x: auto;
    scrollbar-width: none; border-bottom: 1px solid var(--line);
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    flex: none; height: 34px; padding: 0 14px; border-radius: 99px;
    background: var(--panel); border: 1px solid var(--line);
    font: 600 13px/1 Oswald, sans-serif; text-transform: uppercase; letter-spacing: .04em;
    white-space: nowrap;
  }
  .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

  .stage { padding: 12px 8px; }
  .nav { display: none; }
  .bar { padding-bottom: env(safe-area-inset-bottom); }
}
