/* ============================================================
   Buku Audio – الأَصْدِقَاءُ الثَّلَاثَةُ / Tiga Sahabat
   Warna diambil dari ilustrasi buku: langit biru, musang oren, tunggul kayu.
   ============================================================ */

@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo-2-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo-2-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo-2-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo-2-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Noto Naskh Arabic"; src: url("../fonts/noto-naskh-arabic-arabic-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Naskh Arabic"; src: url("../fonts/noto-naskh-arabic-arabic-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

:root {
  --sky-top: #c9e7f5;
  --sky: #e6f5fb;
  --grass: #8cc152;
  --grass-deep: #5c9a33;
  --soil: #6b4a2e;
  --soil-deep: #2e1f13;
  --barrel: #5a4a9e;
  --barrel-deep: #3e3278;
  --pink: #df2b7b;
  --orange: #f08a24;
  --orange-deep: #c96a10;
  --sun: #ffd640;
  --paper: #fffef9;
  --ink: #2b2550;
  --ink-soft: #5d5880;

  --font-ms: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-ar: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", "Times New Roman", serif;
  --ease-out: cubic-bezier(.2, .75, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ms);
  color: var(--ink);
  background: var(--sky);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ar { font-family: var(--font-ar); direction: rtl; unicode-bidi: isolate; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; box-shadow: 0 0 0 6px rgba(62, 50, 120, .55); }

/* ============================================================
   SKRIN MULA – kulit buku mengintai dari lubang di rumput
   ============================================================ */
.intro {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center;
  padding: max(20px, 4vh) 16px 0;
  background:
    radial-gradient(120% 70% at 50% 0%, #f4fbfe 0%, rgba(244, 251, 254, 0) 60%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky) 58%);
  overflow: hidden;
  transition: opacity .55s ease, visibility .55s;
}
.intro.is-leaving { opacity: 0; visibility: hidden; }

.intro-copy { position: relative; z-index: 3; text-align: center; max-width: 760px; }
.intro-series {
  margin: 0 0 .2em; font-weight: 700; font-size: clamp(.9rem, 1.1vw + .55rem, 1.1rem);
  color: var(--grass-deep); letter-spacing: .01em;
}
.intro-title { margin: 0; font-weight: 400; line-height: 1; }
.intro-title .ar {
  display: block;
  font-weight: 700;
  font-size: clamp(2.6rem, 5.2vw + 3.2vh, 5.6rem);
  line-height: 1.55;
  color: var(--barrel);
  text-shadow: 0 .05em 0 #fff, 0 .09em 0 rgba(62, 50, 120, .18);
}
.intro-sub {
  display: block; margin-top: -.15em;
  font-weight: 800; font-size: clamp(1.15rem, 1.4vw + .8rem, 1.75rem);
  color: var(--pink);
}

.intro-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px;
  margin-top: clamp(14px, 3vh, 28px);
}
.start-btn {
  display: inline-flex; align-items: center; gap: 12px;
  min-width: 230px; padding: 10px 26px 10px 12px;
  border: 0; border-radius: 999px; cursor: pointer;
  text-align: left;
  transition: transform .15s var(--ease-out), box-shadow .15s;
}
.start-btn:active { transform: translateY(3px); }
.start-btn--auto { background: var(--barrel); color: #fff; box-shadow: 0 5px 0 var(--barrel-deep), 0 12px 24px rgba(62, 50, 120, .25); }
.start-btn--auto:active { box-shadow: 0 2px 0 var(--barrel-deep), 0 6px 14px rgba(62, 50, 120, .25); }
.start-btn--self { background: #fff; color: var(--barrel); box-shadow: 0 5px 0 #c9c2e6, 0 12px 24px rgba(62, 50, 120, .14); }
.start-btn--self:active { box-shadow: 0 2px 0 #c9c2e6, 0 6px 14px rgba(62, 50, 120, .14); }
.start-icon {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
}
.start-btn--auto .start-icon { background: var(--orange); color: #fff; box-shadow: inset 0 -3px 0 var(--orange-deep); }
.start-btn--self .start-icon { background: #efeafc; color: var(--barrel); }
.start-icon svg { width: 28px; height: 28px; }
.start-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.start-text .ar { font-size: 1.55rem; font-weight: 700; line-height: 1.5; }
.start-text .ms { font-size: 1.05rem; font-weight: 700; opacity: .92; }

.intro-help {
  display: flex; flex-direction: column; gap: 2px;
  margin: clamp(10px, 2vh, 18px) auto 0; max-width: 56ch;
  font-size: .95rem; line-height: 1.35; color: var(--ink-soft);
}
.intro-help b { color: var(--ink); font-weight: 700; }

/* lubang + buku */
.intro { --bw: min(47vh, 64vw, 440px); --hw: calc(var(--bw) * 1.62); --hh: calc(var(--bw) * .42); }
.intro-ground {
  position: absolute; left: -5%; right: -5%; bottom: 0; height: calc(var(--hh) * .5 + 15vh);
  background:
    radial-gradient(60% 50% at 30% 0%, rgba(255, 255, 255, .25), transparent 70%),
    linear-gradient(180deg, #a5d466 0%, var(--grass) 30%, var(--grass-deep) 100%);
  border-radius: 50% 50% 0 0 / 28px 28px 0 0;
  z-index: 1;
}
.pit {
  position: absolute; left: 50%; bottom: 15vh; z-index: 2;
  width: var(--hw); height: calc(var(--bw) * 1.15);
  transform: translateX(-50%) translateY(calc(var(--hh) * .5));
}
.pit-hole {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--hh);
  border-radius: 50%;
  background: radial-gradient(70% 80% at 50% 70%, var(--soil-deep) 0%, #3d2a1a 55%, var(--soil) 92%, #8a6440 100%);
  box-shadow: inset 0 calc(var(--hh) * .12) calc(var(--hh) * .18) rgba(0, 0, 0, .45), 0 2px 0 rgba(255, 255, 255, .25);
}
.pit-clip {
  position: absolute; inset: 0;
  -webkit-mask:
    linear-gradient(#000, #000) top / 100% calc(100% - var(--hh) * .5) no-repeat,
    radial-gradient(closest-side, #000 99%, transparent 100%) bottom / 100% var(--hh) no-repeat;
          mask:
    linear-gradient(#000, #000) top / 100% calc(100% - var(--hh) * .5) no-repeat,
    radial-gradient(closest-side, #000 99%, transparent 100%) bottom / 100% var(--hh) no-repeat;
}
.pit-book {
  position: absolute; left: 50%; bottom: calc(var(--bw) * -.38);
  width: var(--bw); height: var(--bw);
  border-radius: 6px;
  transform: translateX(-50%) rotate(-5deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), -10px 14px 30px rgba(0, 0, 0, .28);
  animation: peek 1.1s .25s var(--ease-out) both;
}
.pit-shade {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--hh);
  border-radius: 50%;
  background: radial-gradient(60% 70% at 50% 100%, rgba(28, 16, 8, .7) 0%, rgba(28, 16, 8, 0) 75%);
  pointer-events: none;
}
.pit-book:not([src]) { visibility: hidden; }
@keyframes peek {
  from { transform: translateX(-50%) translateY(70%) rotate(4deg); }
  to   { transform: translateX(-50%) translateY(0) rotate(-5deg); }
}
.intro.is-leaving .pit-book { animation: rise .6s var(--ease-out) forwards; }
@keyframes rise {
  from { transform: translateX(-50%) translateY(0) rotate(-5deg); }
  to   { transform: translateX(-50%) translateY(-28%) rotate(0deg) scale(1.04); }
}

@media (max-height: 560px) and (orientation: landscape) {
  .intro { flex-direction: row; justify-content: flex-start; align-items: center; padding: 12px 24px; --bw: min(52vh, 34vw); }
  .intro-copy { width: 56%; text-align: center; }
  .intro-help { display: none; }
  .intro-title .ar { font-size: clamp(2rem, 8vh, 3.4rem); }
  .pit { left: 78%; bottom: 18vh; }
  .intro-ground { height: calc(var(--hh) * .5 + 18vh); }
}
@media (max-width: 520px) {
  .start-btn { min-width: 0; width: min(100%, 300px); }
  .intro-help { font-size: .88rem; }
}

/* ============================================================
   PEMBACA
   ============================================================ */
.app {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  height: 100vh; height: 100dvh;
  background:
    radial-gradient(90% 60% at 50% 38%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky) 55%, #e4f2d2 82%, #c3e199 100%);
  padding-top: env(safe-area-inset-top);
}

/* --- bar atas --- */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left));
}
.modes {
  justify-self: start;
  display: inline-flex; padding: 4px; gap: 4px;
  background: rgba(255, 255, 255, .85); border-radius: 999px;
  box-shadow: 0 2px 0 rgba(62, 50, 120, .12), 0 6px 18px rgba(62, 50, 120, .08);
}
.mode {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 48px; padding: 2px 16px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-soft); cursor: pointer; line-height: 1.05;
  transition: background-color .2s, color .2s;
}
.mode .ar { font-size: 1.05rem; font-weight: 700; line-height: 1.45; }
.mode .ms { font-size: .78rem; font-weight: 700; }
.mode[aria-checked="true"] { background: var(--barrel); color: #fff; box-shadow: inset 0 -3px 0 var(--barrel-deep); }
.mode:not([aria-checked="true"]):hover { background: #efeafc; color: var(--barrel); }

.booktitle { display: flex; flex-direction: column; align-items: center; line-height: 1; text-align: center; }
.booktitle .ar { font-weight: 700; font-size: 1.6rem; line-height: 1.5; color: var(--barrel); }
.booktitle .ms { font-weight: 700; font-size: .9rem; color: var(--pink); margin-top: -.2em; }

.topbar-end { justify-self: end; display: flex; gap: 8px; }
.icon-btn {
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, .85); color: var(--barrel);
  box-shadow: 0 2px 0 rgba(62, 50, 120, .14), 0 6px 18px rgba(62, 50, 120, .08);
}
.icon-btn:hover { background: #fff; }
.icon-btn svg { width: 24px; height: 24px; pointer-events: none; }
.icon-btn .i-off { display: none; }
.icon-btn[aria-pressed="true"] .i-on { display: none; }
.icon-btn[aria-pressed="true"] .i-off { display: block; }

/* --- pentas buku --- */
.stage { position: relative; min-height: 0; display: grid; place-items: center; }
.book-shift { position: relative; transition: transform .6s var(--ease-out); will-change: transform; }
.book-shadow {
  position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
  border-radius: 6px;
  box-shadow: 0 2px 2px rgba(43, 37, 80, .12), 0 18px 34px -6px rgba(43, 37, 80, .32), 0 40px 60px -30px rgba(60, 100, 30, .35);
  transition: left .5s var(--ease-out), width .5s var(--ease-out);
}
.book-shadow[data-part="left"] { left: 0; width: 50%; }
.book-shadow[data-part="right"] { left: 50%; width: 50%; }
.book { position: relative; }

/* gaya asas pustaka StPageFlip */
.stf__parent { position: relative; display: block; box-sizing: border-box; transform: translateZ(0); touch-action: pan-y; }
.stf__wrapper { position: relative; width: 100%; box-sizing: border-box; }
.stf__parent canvas { position: absolute; width: 100%; height: 100%; left: 0; top: 0; }
.stf__block { position: absolute; width: 100%; height: 100%; box-sizing: border-box; perspective: 2000px; }
.stf__item { display: none; position: absolute; transform-style: preserve-3d; }
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow { position: absolute; left: 0; top: 0; }

/* halaman */
.page { background: #fff; overflow: hidden; user-select: none; -webkit-user-select: none; }
.page-inner { position: absolute; inset: 0; }
.page-inner > img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.page-inner::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
html:not(.is-portrait) .page--left .page-inner::after { background: linear-gradient(to left, rgba(70, 50, 30, .22), rgba(70, 50, 30, .06) 3%, rgba(70, 50, 30, 0) 8%); }
html:not(.is-portrait) .page--right .page-inner::after { background: linear-gradient(to right, rgba(70, 50, 30, .22), rgba(70, 50, 30, .06) 3%, rgba(70, 50, 30, 0) 8%); }

/* kawasan teks Arab: bercahaya semasa dibaca, boleh diketik */
.hl {
  position: absolute; margin: 0; padding: 0; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer;
  transition: background-color .16s ease, box-shadow .16s ease;
}
.page.is-speaking .hl,
.hl.is-on {
  background: rgba(255, 214, 64, .6);
  mix-blend-mode: multiply;
  box-shadow: 0 0 0 4px rgba(255, 214, 64, .3);
}
@media (hover: hover) {
  .hl:hover { background: rgba(255, 214, 64, .28); mix-blend-mode: multiply; }
}

/* butang pembesar suara di setiap halaman beraudio */
.spk {
  position: absolute; top: 3%; width: 9.5%; min-width: 34px; aspect-ratio: 1 / 1;
  margin: 0; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .94); color: var(--barrel);
  box-shadow: 0 2px 0 rgba(62, 50, 120, .25), 0 4px 12px rgba(0, 0, 0, .14);
  transition: background-color .2s, color .2s, transform .15s;
}
.spk:active { transform: scale(.92); }
.spk svg { width: 60%; height: 60%; pointer-events: none; }
.spk .w1, .spk .w2 { transform-box: fill-box; transform-origin: left center; }
.page--left .spk { left: 3%; }
.page--right .spk { right: 3%; }
.page.is-playing .spk { background: var(--barrel); color: #fff; }
.page.is-playing .spk .w1 { animation: wave .9s ease-in-out infinite; }
.page.is-playing .spk .w2 { animation: wave .9s .15s ease-in-out infinite; }
@keyframes wave { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
html.hint .spk { animation: nudge 1.1s ease-in-out 3; }
@keyframes nudge {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 0 rgba(62, 50, 120, .25), 0 0 0 0 rgba(255, 214, 64, .9); }
  50% { transform: scale(1.12); box-shadow: 0 2px 0 rgba(62, 50, 120, .25), 0 0 0 10px rgba(255, 214, 64, 0); }
}

/* --- kad tamat --- */
.endcard {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 20; width: min(92%, 420px);
  padding: 14px 18px 18px; border-radius: 26px; text-align: center;
  background: var(--paper);
  box-shadow: 0 4px 0 rgba(62, 50, 120, .14), 0 24px 50px rgba(43, 37, 80, .28);
  animation: pop .45s var(--ease-out);
}
.endcard .ar { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.6; color: var(--barrel); }
.endcard .ms { margin: -.2em 0 12px; font-weight: 700; color: var(--pink); font-size: 1.1rem; }
.endcard-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.96); } }

.pill-btn {
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1.05;
  min-height: 52px; padding: 4px 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: #efeafc; color: var(--barrel);
  box-shadow: 0 3px 0 #cfc6ee;
}
.pill-btn .ar { font-size: 1.15rem !important; line-height: 1.5 !important; color: inherit !important; }
.pill-btn .ms { margin: 0 !important; font-size: .85rem !important; color: inherit !important; }
.pill-btn--primary { background: var(--barrel); color: #fff; box-shadow: 0 3px 0 var(--barrel-deep); }
.pill-btn:active { transform: translateY(2px); box-shadow: none; }

/* --- dok bawah --- */
.dock {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px max(16px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
}
.dock-mid {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 2px 0 rgba(62, 50, 120, .12), 0 8px 22px rgba(62, 50, 120, .1);
}
.btn-label { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.btn-label .ar { font-size: .98rem; font-weight: 700; line-height: 1.45; }
.btn-label .ms { font-size: .76rem; font-weight: 700; color: var(--ink-soft); }

.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 0; border: 0; background: none; cursor: pointer; color: var(--barrel);
}
.nav-circle {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--barrel); color: #fff;
  box-shadow: 0 4px 0 var(--barrel-deep), 0 10px 20px rgba(62, 50, 120, .22);
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.nav-circle svg { width: 30px; height: 30px; }
.nav-btn--next { flex-direction: row-reverse; }
.nav-btn:active .nav-circle { transform: translateY(3px); box-shadow: 0 1px 0 var(--barrel-deep), 0 4px 10px rgba(62, 50, 120, .2); }
.nav-btn:disabled { cursor: default; }
.nav-btn:disabled .nav-circle { opacity: .3; box-shadow: none; }
.nav-btn:disabled .btn-label { opacity: .35; }

.tool-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0; border: 0; background: none; cursor: pointer; color: var(--barrel);
}
.tool-circle {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: #efeafc; color: var(--barrel);
  transition: transform .12s;
}
.tool-circle svg { width: 24px; height: 24px; }
.tool-btn:active .tool-circle { transform: scale(.92); }
.tool-btn--main .tool-circle {
  width: 54px; height: 54px; background: var(--orange); color: #fff;
  box-shadow: inset 0 -3px 0 var(--orange-deep);
}
.tool-btn--main .tool-circle svg { width: 28px; height: 28px; }
.tool-btn--main svg { display: none; }
.tool-btn--main[data-icon="play"] .i-play,
.tool-btn--main[data-icon="pause"] .i-pause,
.tool-btn--main[data-icon="listen"] .i-listen { display: block; }

.pageinfo { display: flex; flex-direction: column; align-items: center; min-width: 74px; line-height: 1.1; direction: ltr; }
.pageinfo-label { font-size: .75rem; font-weight: 700; color: var(--ink-soft); }
.pageinfo-num { font-size: 1.05rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.pageinfo-num b { font-size: 1.3rem; font-weight: 800; color: var(--ink); }

/* --- senarai halaman --- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(43, 37, 80, .42); animation: fade .25s ease; }
.sheet-panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 980px); max-height: 78vh; max-height: 78dvh;
  display: flex; flex-direction: column;
  background: var(--paper); border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 40px rgba(43, 37, 80, .3);
  padding-bottom: env(safe-area-inset-bottom);
  animation: slideup .35s var(--ease-out);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px 22px; }
.sheet-head h2 { margin: 0; display: flex; align-items: baseline; gap: 12px; line-height: 1.2; }
.sheet-head h2 .ar { font-size: 1.5rem; color: var(--barrel); line-height: 1.6; }
.sheet-head h2 .ms { font-size: 1.05rem; font-weight: 700; color: var(--ink-soft); }
.sheet-head .icon-btn { background: #efeafc; box-shadow: none; }
.sheet-grid {
  overflow-y: auto; padding: 8px 18px 22px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
}
.thumb {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px; border: 0; border-radius: 16px; cursor: pointer;
  background: transparent;
}
.thumb:hover { background: #f1eefb; }
.thumb-pages { display: flex; direction: rtl; box-shadow: 0 2px 6px rgba(43, 37, 80, .2); border-radius: 4px; overflow: hidden; }
.thumb-pages img { display: block; width: 66px; height: 66px; pointer-events: none; }
.thumb-pages.single img { width: 66px; }
.thumb-num { font-weight: 700; font-size: .9rem; color: var(--ink-soft); direction: ltr; }
.thumb[aria-current="true"] { background: #e7e1fa; }
.thumb[aria-current="true"] .thumb-num { color: var(--barrel); }
.thumb .has-audio { display: inline-block; width: 7px; height: 7px; margin-inline-start: 6px; border-radius: 50%; background: var(--orange); vertical-align: middle; }

@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateX(-50%) translateY(40px); opacity: 0; } }

/* --- saiz skrin --- */
@media (max-width: 860px) {
  .booktitle { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
}
@media (max-width: 640px) {
  .btn-label { display: none; }
  .nav-circle { width: 56px; height: 56px; }
  .dock-mid { gap: 10px; padding: 6px 10px; }
  .mode { padding: 2px 12px; }
  .mode .ar { font-size: .98rem; }
  .mode .ms { font-size: .72rem; }
  .icon-btn { width: 44px; height: 44px; }
}
@media (max-width: 380px) {
  .mode { padding: 2px 9px; }
  .topbar-end { gap: 6px; }
  .pageinfo { min-width: 58px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .topbar { padding-top: 6px; }
  .btn-label { display: none; }
  .nav-circle { width: 52px; height: 52px; }
  .dock { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .mode { min-height: 42px; }
}

.noscript { position: fixed; inset: auto 0 0; margin: 0; padding: 16px; text-align: center; background: var(--sun); font-weight: 700; z-index: 100; }

@media (prefers-reduced-motion: reduce) {
  .pit-book, .intro.is-leaving .pit-book { animation: none; }
  .book-shift, .book-shadow { transition: none; }
  html.hint .spk { animation: none; }
  .endcard, .sheet-panel, .sheet-backdrop { animation: none; }
}

/* ============================================================
   TEMA BUKU: Tiga Sahabat
   ============================================================ */
:root {
  --sky-top: #d3e6f6;       /* langit cat air dalam buku */
  --sky: #f0f7fc;
  --barrel: #2e5d8c;        /* biru tajuk kulit buku */
  --barrel-deep: #1d3f63;
  --pink: #d2561c;          /* oren musang */
}
.start-btn--self { box-shadow: 0 5px 0 #c3d4e6, 0 12px 24px rgba(29, 63, 99, .14); }
.start-btn--self .start-icon, .tool-circle, .pill-btn, .sheet-head .icon-btn { background: #e5eef7; }
.mode:not([aria-checked="true"]):hover, .thumb:hover { background: #e5eef7; }
.thumb[aria-current="true"] { background: #d8e5f2; }
.pill-btn { box-shadow: 0 3px 0 #c3d4e6; }

/* skrin mula: kulit buku mengintai dari dalam tunggul kayu berlubang */
.intro--log .pit-hole {
  background: radial-gradient(closest-side, #1c120b 0%, #2e1d12 52%, #5a3a22 66%, #b07a48 74%, #c99260 80%, #a46d3d 86%, #c48c58 91%, #7a4c2a 96%);
  box-shadow:
    0 0 0 calc(var(--hh) * .05) #5b3a21,
    0 calc(var(--hh) * .1) 0 calc(var(--hh) * .05) #4a2e19,
    inset 0 calc(var(--hh) * .1) calc(var(--hh) * .16) rgba(0, 0, 0, .45);
}
.intro--log .pit-shade { background: radial-gradient(60% 70% at 50% 100%, rgba(20, 12, 6, .7) 0%, rgba(20, 12, 6, 0) 75%); }

/* sorotan teks: isian kuning (multiply, teks kekal gelap) + cincin kuning terang
   supaya jelas di atas latar biru dan kuning */
.page.is-speaking .hl, .hl.is-on { background: transparent; mix-blend-mode: normal; box-shadow: none; }
.hl::before, .hl::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity .16s ease;
}
.hl::before { background: rgba(255, 222, 80, .7); mix-blend-mode: multiply; }
.hl::after { box-shadow: 0 0 0 3px rgba(255, 214, 40, .95), 0 0 18px 5px rgba(255, 230, 120, .65); }
.page.is-speaking .hl::before, .page.is-speaking .hl::after,
.hl.is-on::before, .hl.is-on::after { opacity: 1; }
@media (hover: hover) {
  .hl:hover { background: transparent; mix-blend-mode: normal; }
  .hl:hover::before { opacity: .45; }
}

/* ---------- perlindungan ringan (versi upload) ---------- */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; pointer-events: none; }
@media print {
  html, body { background: #fff !important; overflow: visible !important; }
  body > * { display: none !important; }
  body::before {
    content: "Cetakan tidak dibenarkan. Kandungan buku ini dilindungi hak cipta.";
    display: block; padding: 48px 24px; text-align: center;
    font: 700 18px/1.5 sans-serif; color: #000;
  }
}
