/* Cerita Sang Kancil — gaya buku cerita. Token dari /taman-main/css/base.css (warna, garis #33262B, Baloo 2). */
:root { --kertas: #FFFDF6; --bayang: 0 6px 0 rgba(51,38,43,.22); --w: #3BA7C9; --wl: #DDF1F7; --kiri-selamat: 112px; }
#app { position: fixed; inset: 0; overflow: hidden; }
#app > section { position: absolute; inset: 0; }
button { cursor: pointer; }
.big-btn svg, .kb-btn svg, .nav svg, .bb-mod svg, .dengar-btn svg, .ulang-soal svg, .kecil svg, .baca-pill svg { color: #fff; }

/* ============ PUSTAKA ============ */
.pustaka { display: flex; flex-direction: column; background: var(--bg); }
.pustaka::before { content: ''; position: absolute; inset: auto 0 0 0; height: 34%; background: #E6F4D8; border-top: 5px solid var(--line); border-radius: 50% 50% 0 0 / 40px 40px 0 0; z-index: 0; }
.ps-kepala { position: relative; z-index: 2; flex: none; display: flex; align-items: center; justify-content: center; min-height: 104px;
  padding: calc(10px + var(--safe-t)) var(--kiri-selamat) 4px; }
.ps-kepala h1 { margin: 0; font-size: clamp(30px, 4.6vw, 50px); font-weight: 800; line-height: 1; text-align: center; letter-spacing: .3px; }
.ps-kepala h1 span { color: var(--pink); display: inline-block; }
.rak { position: relative; z-index: 1; flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: max-content; gap: clamp(14px, 2.2vw, 26px); align-content: start;
  max-width: 1160px; width: 100%; margin: 0 auto; padding: 14px clamp(14px, 2.4vw, 28px) calc(40px + env(safe-area-inset-bottom, 0px)); }
.buku { position: relative; display: flex; flex-direction: column; padding: 0; text-align: left; background: #fff; color: var(--ink);
  border: 5px solid var(--ink); border-radius: 26px; overflow: hidden; box-shadow: 0 8px 0 rgba(51,38,43,.22);
  animation: tma-pop-in .45s both cubic-bezier(.3,1.5,.5,1); transition: transform .15s; }
.buku:active { transform: translateY(5px) scale(.98); box-shadow: 0 3px 0 rgba(51,38,43,.22); }
.kulit { position: relative; flex: none; aspect-ratio: 4 / 3; background: var(--wl); border-bottom: 5px solid var(--ink); overflow: hidden; }
.kulit-seni { position: absolute; inset: 0; }
.kulit-seni .adegan, .kb-seni .adegan { position: absolute; inset: 0; }
.tulang { position: absolute; left: 0; top: 0; bottom: 0; width: 16px; background: var(--w); border-right: 4px solid var(--ink); }
.tulang::after { content: ''; position: absolute; left: 3px; right: 3px; top: 12px; bottom: 12px; border-top: 3px solid rgba(255,255,255,.6); border-bottom: 3px solid rgba(255,255,255,.6); }
.lencana-tamat { position: absolute; right: 8px; top: 8px; display: flex; align-items: center; gap: 3px; padding: 2px 10px 2px 6px; border-radius: 999px;
  background: var(--green); color: #fff; border: 3px solid var(--ink); font-size: 14px; font-weight: 800; }
.lencana-tamat svg { width: 18px; height: 18px; color: #fff; }
.buku-info { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px 14px; background: #fff; }
.buku-tajuk { font-size: clamp(17px, 1.9vw, 22px); font-weight: 800; line-height: 1.15; min-height: 2.3em; }
.buku-bawah { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.bintang { display: flex; gap: 1px; }
.bt svg { width: 24px; height: 24px; color: #EADFCC; display: block; }
.bt.on svg { color: var(--yellow); filter: drop-shadow(0 0 0 var(--ink)); }
.bt.on svg path { stroke: var(--ink); stroke-width: 3.5; }
.baca-pill { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 4px 16px 4px 10px; border-radius: 999px; background: var(--w);
  color: #fff; border: 4px solid var(--ink); font-size: 19px; font-weight: 800; box-shadow: 0 4px 0 rgba(51,38,43,.22);
  text-shadow: 0 2px 0 rgba(51,38,43,.35); }
.baca-pill svg { width: 22px; height: 22px; }

/* ============ KULIT BUKU (pilih mod) ============ */
.kulit-buku { display: grid; grid-template-columns: 1.15fr 1fr; background: var(--wl); }
.kb-seni { position: relative; border-right: 6px solid var(--ink); overflow: hidden; }
.kb-kad { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 28px clamp(20px, 3vw, 44px); background: var(--kertas); }
.kb-kad::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 22px; background: var(--w); border-right: 5px solid var(--ink); }
.kb-tajuk { margin: 0 0 0 10px; font-size: clamp(32px, 4.2vw, 52px); line-height: 1.02; font-weight: 800; }
.kb-ringkas { margin: 0 0 0 10px; font-size: clamp(18px, 1.9vw, 23px); font-weight: 600; line-height: 1.35; color: #5B4A44; }
.kb-pilih { display: flex; flex-direction: column; gap: 14px; margin: 6px 0 0 10px; }
.kb-btn { display: flex; align-items: center; gap: 12px; min-height: 92px; padding: 10px 28px 10px 20px; border-radius: 999px; border: 5px solid var(--ink);
  font-size: clamp(24px, 2.6vw, 32px); font-weight: 800; color: #fff; box-shadow: 0 7px 0 rgba(51,38,43,.25);
  text-shadow: 0 2px 0 rgba(51,38,43,.4); animation: tma-pop-in .4s both cubic-bezier(.3,1.5,.5,1); }
.kb-btn svg { width: 46px; height: 46px; flex: none; }
.kb-btn.dengar { background: var(--pink); }
.kb-btn.baca { background: var(--blue); animation-delay: .08s; }
.kb-btn:active, .big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(51,38,43,.25); }
.kb-balik { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; min-height: 52px; padding: 4px 14px 4px 6px;
  background: none; border: 0; color: var(--muted); font-size: 19px; font-weight: 800; }
.kb-balik svg { width: 26px; height: 26px; color: var(--muted); }

/* ============ PEMBACA ============ */
.buku-baca { display: flex; flex-direction: column; background: var(--kertas); }
.bb-atas { position: absolute; z-index: 20; top: calc(14px + var(--safe-t)); left: var(--kiri-selamat); right: 14px; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px; pointer-events: none; }
.bb-atas > * { pointer-events: auto; }
.bb-tajuk { flex: 0 1 auto; min-width: 0; margin: 10px auto 0; padding: 6px 18px; border-radius: 999px; background: rgba(255,253,246,.92);
  border: 4px solid var(--ink); font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
  box-shadow: var(--bayang); pointer-events: none; }
.bb-mod { flex: none; margin-left: auto; display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 6px 20px 6px 14px; border-radius: 999px; border: 4px solid var(--ink);
  background: var(--blue); color: #fff; font-size: 19px; font-weight: 800; box-shadow: var(--bayang); text-shadow: 0 2px 0 rgba(51,38,43,.35); }
.bb-mod.dengar { background: var(--pink); }
.bb-mod svg { width: 34px; height: 34px; }
.bb-mod:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(51,38,43,.22); }
.bb-muka-wrap { position: relative; flex: 1; min-height: 0; perspective: 2200px; touch-action: pan-y; }
.bb-muka { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--kertas); }
.bb-pentas { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.bb-pentas .adegan, .bb-pentas .prop, .lakaran .adegan, .lakaran .prop, .kulit-seni .prop, .kb-seni .prop { position: absolute; left: 0; top: 0; pointer-events: none; }
.lapis-watak { position: absolute; inset: 0; }
.wt { position: absolute; touch-action: none; }
.bb-pentas .wt { cursor: pointer; }
.wt-seni, .wt-seni svg { width: 100%; height: 100%; display: block; }
.wt.picit .wt-seni { animation: picit .45s cubic-bezier(.3,1.6,.5,1); transform-origin: 50% 95%; }
@keyframes picit { 0% { transform: scale(1.12, .86) } 45% { transform: scale(.94, 1.08) } 100% { transform: none } }
.riak { position: absolute; left: 4%; right: 4%; height: 7%; border-radius: 50%; background: #8FD3F5; border: 4px solid var(--ink); opacity: .95;
  animation: riak 2.2s ease-in-out infinite; }
.riak::after { content: ''; position: absolute; left: 14%; top: 22%; width: 28%; height: 26%; border-top: 4px solid #fff; border-radius: 50%; }
@keyframes riak { 0%,100% { transform: scaleX(1) } 50% { transform: scaleX(1.06) } }
.gelembung { position: absolute; z-index: 15; max-width: min(320px, 70%); padding: 10px 18px; border-radius: 24px; background: #fff; border: 4px solid var(--ink);
  font-size: 22px; font-weight: 800; line-height: 1.2; box-shadow: var(--bayang); animation: tma-pop-in .3s cubic-bezier(.3,1.6,.5,1); pointer-events: none;
  transition: opacity .35s, transform .35s; }
.gelembung::after { content: ''; position: absolute; left: calc(var(--ekor, 50%) - 12px); bottom: -15px; width: 20px; height: 20px; background: #fff;
  border-right: 4px solid var(--ink); border-bottom: 4px solid var(--ink); transform: rotate(45deg); border-radius: 0 0 6px 0; }
.gelembung.bawah::after { bottom: auto; top: -15px; transform: rotate(225deg); }
.gelembung.hilang { opacity: 0; transform: translateY(-8px); }

.bb-bawah { position: relative; flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(10px, 1.6vw, 20px);
  padding: 16px clamp(12px, 2vw, 24px) calc(26px + env(safe-area-inset-bottom, 0px)); background: var(--kertas); border-top: 5px solid var(--ink); }
.bb-bawah::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--w); opacity: .35; }
.kertas { position: relative; min-height: 120px; display: flex; align-items: center; padding: 10px 112px 10px 22px; border-radius: 24px; background: #fff;
  border: 4px solid var(--line); }
.kertas.bercakap { border-color: var(--yellow); }
.teks { margin: 0; font-size: clamp(22px, 2.6vw, 32px); font-weight: 700; line-height: 1.42; color: var(--ink); }
.pk { display: inline-block; border-radius: 10px; padding: 0 2px; margin: 0 -2px; transition: background-color .12s, transform .12s; }
.pk.on { background: var(--yellow); transform: translateY(-2px) scale(1.06); box-shadow: 0 3px 0 rgba(51,38,43,.2); }
.dengar-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 88px; height: 88px; border-radius: 26px; border: 4px solid var(--ink); background: var(--orange); color: #fff; font-size: 15px; font-weight: 800;
  box-shadow: var(--bayang); text-shadow: 0 2px 0 rgba(51,38,43,.35); }
.dengar-btn svg { width: 40px; height: 40px; }
.dengar-btn:active { transform: translateY(calc(-50% + 4px)); box-shadow: 0 2px 0 rgba(51,38,43,.22); }
.nav { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 104px; height: 104px; border-radius: 34px; border: 5px solid var(--ink);
  background: var(--green); color: #fff; font-size: 17px; font-weight: 800; box-shadow: 0 7px 0 rgba(51,38,43,.25); text-shadow: 0 2px 0 rgba(51,38,43,.35); }
.nav svg { width: 46px; height: 46px; }
.nav.sebelum { background: #fff; color: var(--ink); text-shadow: none; }
.nav.sebelum svg { color: var(--ink); }
.nav.seterus svg { order: -1; }
.nav.tamat { background: var(--pink); animation: tma-wiggle 1.2s ease-in-out infinite; }
.nav.tamat svg { color: var(--yellow); }
.nav.tamat svg path { stroke: var(--ink); stroke-width: 3; }
.nav:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(51,38,43,.25); }
.nav[disabled] { opacity: .35; pointer-events: none; }
.bb-titik { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); display: flex; gap: 7px;
  padding: 6px 12px; border-radius: 999px; background: var(--kertas); border: 4px solid var(--ink); z-index: 5; }
.bb-titik i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.bb-titik i.lalu { background: var(--w); opacity: .55; }
.bb-titik i.on { background: var(--w); width: 26px; border-radius: 6px; opacity: 1; }
/* selak halaman */
.selak { z-index: 10; backface-visibility: hidden; box-shadow: 0 0 0 rgba(0,0,0,0); pointer-events: none; }
.selak::after { content: ''; position: absolute; inset: 0; background: #33262B; opacity: 0; animation: selak-gelap .65s ease-in forwards; }
.selak.ke-kiri { transform-origin: 0 50%; animation: selak-kiri .65s cubic-bezier(.45,.05,.55,.95) forwards; }
.selak.ke-kanan { transform-origin: 100% 50%; animation: selak-kanan .65s cubic-bezier(.45,.05,.55,.95) forwards; }
@keyframes selak-kiri { from { transform: rotateY(0) } to { transform: rotateY(-100deg) } }
@keyframes selak-kanan { from { transform: rotateY(0) } to { transform: rotateY(100deg) } }
@keyframes selak-gelap { to { opacity: .35 } }
body.baca-buku .voice-skip { display: none; }

/* animasi latar */
.awan > g { animation: awan 16s ease-in-out infinite alternate; }
.awan.lambat > g { animation-duration: 24s; }
@keyframes awan { from { translate: -14px 0 } to { translate: 22px 0 } }
.putar { animation: putar 24s linear infinite; }
@keyframes putar { to { rotate: 360deg } }
.goyang { animation: goyang 4.5s ease-in-out infinite; }
@keyframes goyang { 0%,100% { rotate: 0deg } 50% { rotate: 1.4deg } }
.ayun { animation: ayun 3s ease-in-out infinite; }
@keyframes ayun { 0%,100% { rotate: -4deg } 50% { rotate: 4deg } }
.ombak { animation: ombak 3s ease-in-out infinite; }
@keyframes ombak { 0%,100% { translate: 0 0 } 50% { translate: 12px 2px } }
.kelip { animation: kelip 2.4s ease-in-out infinite; }
@keyframes kelip { 0%,100% { scale: 1; opacity: 1 } 50% { scale: .7; opacity: .6 } }
.kunang { animation: kunang 4s ease-in-out infinite; }
@keyframes kunang { 0%,100% { translate: 0 0; opacity: 1 } 50% { translate: 10px -16px; opacity: .45 } }
.lebah { animation: lebah 1.6s ease-in-out infinite; }
@keyframes lebah { 0%,100% { translate: 0 0 } 50% { translate: 6px -8px } }
.lakaran .awan > g, .lakaran .putar, .lakaran .goyang, .lakaran .ayun, .lakaran .ombak, .lakaran .kelip, .lakaran .kunang, .lakaran .lebah,
.kulit-seni *, .selak * { animation: none !important; }

/* ============ TAMAT ============ */
.skrin-tamat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--w); overflow: hidden; }
.sinar { position: absolute; inset: -50%; background: repeating-conic-gradient(rgba(255,255,255,.16) 0 9deg, transparent 9deg 18deg); animation: putar 40s linear infinite; }
.tamat-tajuk { position: relative; margin: 0; font-size: clamp(64px, 11vw, 130px); font-weight: 800; line-height: 1; color: #fff; letter-spacing: 2px;
  -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 rgba(51,38,43,.3); animation: tma-pop-in .6s cubic-bezier(.3,1.6,.5,1) both; }
.tamat-watak { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 0; max-width: 96vw; }
.tw { width: min(200px, calc(92vw / var(--n, 2))); margin: 0 -6px; animation: tma-pop-in .5s both cubic-bezier(.3,1.6,.5,1); }
.tw svg { width: 100%; height: auto; display: block; }
.skrin-tamat .big-btn { position: relative; font-size: 32px; min-height: 96px; padding: 10px 40px 10px 28px; background: var(--pink); animation: tma-wiggle 1.4s 1s ease-in-out infinite; }
.skrin-tamat .big-btn svg { width: 46px; height: 46px; }

/* ============ AKTIVITI ============ */
.skrin-akt { display: flex; flex-direction: column; background: var(--wl); padding: calc(14px + var(--safe-t)) clamp(14px, 2.4vw, 30px) calc(20px + env(safe-area-inset-bottom, 0px)); }
.skrin-akt::before, .skrin-pengajaran::before, .skrin-simpulan::before { content: ''; position: absolute; left: -10%; right: -10%; bottom: -40px; height: 22%;
  background: #CDEBB4; border-top: 5px solid rgba(51,38,43,.12); border-radius: 50% 50% 0 0; pointer-events: none; }
.skrin-akt > *, .skrin-pengajaran > *, .skrin-simpulan > * { position: relative; }
.skrin-akt > .akt-kawan { position: absolute; }
.akt-kepala { flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 var(--kiri-selamat); }
.akt-langkah { display: flex; gap: 10px; }
.akt-langkah i { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--ink); background: #fff;
  font-style: normal; font-weight: 800; font-size: 19px; }
.akt-langkah i.on { background: var(--yellow); transform: scale(1.12); }
.akt-langkah i.lalu { background: var(--green); }
.akt-langkah i svg { width: 22px; height: 22px; color: var(--yellow); }
.akt-langkah i svg path { stroke: var(--ink); stroke-width: 4; }
.akt-soal { display: flex; align-items: center; gap: 14px; max-width: 900px; padding: 8px 10px 8px 24px; border-radius: 28px; background: #fff; border: 5px solid var(--ink);
  box-shadow: var(--bayang); }
.akt-soal p { margin: 0; font-size: clamp(22px, 2.8vw, 34px); font-weight: 800; line-height: 1.2; }
.ulang-soal { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 88px; height: 88px; border-radius: 24px; border: 4px solid var(--ink);
  background: var(--orange); color: #fff; font-size: 14px; font-weight: 800; box-shadow: var(--bayang); text-shadow: 0 2px 0 rgba(51,38,43,.35); }
.ulang-soal svg { width: 38px; height: 38px; }
.akt-isi { position: relative; flex: 1; min-height: 0; margin-top: 14px; }
.akt-kawan { position: absolute; right: clamp(8px, 2vw, 24px); bottom: calc(6px + env(safe-area-inset-bottom, 0px)); width: clamp(90px, 12vw, 150px); pointer-events: none; z-index: 4; }
.akt-kawan svg { width: 100%; height: auto; display: block; }
/* kuiz */
.akt-kuiz { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 3vw, 40px); padding-bottom: 40px; }
.pilihan { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: clamp(150px, 24vw, 290px); padding: 14px 12px 12px;
  border-radius: 32px; border: 5px solid var(--ink); background: #fff; box-shadow: 0 8px 0 rgba(51,38,43,.22); color: var(--ink);
  animation: tma-pop-in .4s both cubic-bezier(.3,1.5,.5,1); transition: opacity .3s, transform .2s, background-color .2s; }
.pl-seni { width: 82%; aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center; }
.pl-seni svg { width: 100%; height: 100%; }
.pilihan b { font-size: clamp(20px, 2.4vw, 28px); font-weight: 800; }
.gm-teks { font-size: clamp(22px, 2.6vw, 32px); font-weight: 800; line-height: 1.15; text-align: center; }
.pilihan:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(51,38,43,.22); }
.pilihan.betul { background: #D5F3E8; border-color: var(--green); box-shadow: 0 0 0 6px var(--ink), 0 10px 0 6px rgba(51,38,43,.22); transform: scale(1.06); }
.pilihan.salah { background: #F6EFE6; }
.pilihan.pudar { opacity: .4; }
/* susun */
.akt-susun { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding-bottom: 20px; }
.slot-baris, .dulang { display: grid; grid-template-columns: repeat(var(--cols), var(--tw)); gap: 18px; }
.slot, .tempat { position: relative; width: var(--tw); height: var(--th); border-radius: 18px; }
.slot { border: 5px dashed rgba(51,38,43,.4); background: rgba(255,255,255,.6); }
.slot.dekat { border-color: var(--green); background: #D5F3E8; transform: scale(1.04); }
.slot.penuh { border-style: solid; border-color: transparent; background: none; }
.slot-no { position: absolute; z-index: 3; left: -14px; top: -14px; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--yellow); border: 4px solid var(--ink); font-size: 22px; font-weight: 800; }
.slot.penuh .slot-no { background: var(--green); color: #fff; }
.tempat { border: 4px dashed rgba(51,38,43,.15); animation: tma-pop-in .4s both; }
.kepingan { position: absolute; inset: -4px; border-radius: 18px; overflow: hidden; border: 5px solid var(--ink); background: #fff; box-shadow: 0 6px 0 rgba(51,38,43,.22);
  cursor: grab; touch-action: none; }
.kepingan .lakaran { position: relative; margin: -5px; pointer-events: none; }
.kepingan.seret { z-index: 30; box-shadow: 0 16px 24px rgba(51,38,43,.3); cursor: grabbing; }
.kepingan.pilih { box-shadow: 0 0 0 6px var(--yellow), 0 6px 0 6px rgba(51,38,43,.22); }
.kepingan.tepat { border-color: var(--green); cursor: default; box-shadow: none; animation: tma-pop-in .35s cubic-bezier(.3,1.6,.5,1); }
/* padan */
.akt-padan { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 22%) minmax(0, 1fr); grid-template-areas: "k . n"; max-width: 1000px; width: 100%;
  margin-left: auto; margin-right: auto; padding-bottom: 30px; }
.pd-lajur { display: flex; flex-direction: column; justify-content: center; gap: clamp(12px, 2vh, 22px); }
.pd-lajur.kiri { grid-area: k; } .pd-lajur.kanan { grid-area: n; }
.pd-garis { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
.pd-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: clamp(96px, 13vh, 150px); padding: 6px 18px 6px 10px; border-radius: 26px; border: 5px solid var(--ink);
  background: #fff; color: var(--ink); box-shadow: 0 6px 0 rgba(51,38,43,.22); text-align: left; touch-action: none; animation: tma-pop-in .4s both; }
.pd-item.tx { justify-content: center; padding: 10px 18px; text-align: center; }
.pd-seni { flex: none; display: block; width: clamp(64px, 11vh, 124px); }
.pd-item.tx .pd-seni { width: auto; }
.pd-seni svg { width: 100%; height: auto; display: block; }
.pd-item b { font-size: clamp(19px, 2.2vw, 26px); font-weight: 800; }
.pd-item .gm-teks { font-size: clamp(20px, 2.4vw, 28px); }
.pd-item.pilih { background: #FFF6CF; box-shadow: 0 0 0 6px var(--yellow), 0 6px 0 6px rgba(51,38,43,.22); }
.pd-item.padan { background: #fff; border-color: var(--pw); box-shadow: 0 0 0 4px var(--ink), 0 6px 0 4px rgba(51,38,43,.22); }
.pd-titik { position: absolute; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; background: #fff; border: 4px solid var(--ink); }
.kiri .pd-titik { right: -14px; } .kanan .pd-titik { left: -14px; }
.pd-item.padan .pd-titik { background: var(--pw); }
.skrin-akt.siap .akt-isi { pointer-events: none; }

/* ============ PENGAJARAN & SIMPULAN ============ */
.skrin-pengajaran, .skrin-simpulan { display: flex; flex-direction: column; align-items: center; background: var(--wl);
  padding: calc(16px + var(--safe-t)) clamp(14px, 3vw, 40px) calc(22px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
.kad-label { margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 6px 22px 6px 14px; border-radius: 999px; background: var(--w); color: #fff;
  border: 5px solid var(--ink); font-size: clamp(24px, 3vw, 34px); font-weight: 800; box-shadow: var(--bayang); text-shadow: 0 2px 0 rgba(51,38,43,.4); }
.kad-label svg { width: 38px; height: 38px; color: var(--yellow); }
.kad-label svg path:first-child { stroke: var(--ink); stroke-width: 3; }
.papan-wrap { position: relative; flex: 1; min-height: 0; width: min(880px, 100%); display: flex; flex-direction: column; align-items: center; }
.papan { position: relative; z-index: 2; width: 100%; padding: clamp(18px, 3vh, 34px) clamp(22px, 4vw, 54px); border-radius: 26px; background: #FFF3DA;
  border: 6px solid var(--ink); box-shadow: inset 0 0 0 10px #D9A066, inset 0 0 0 14px var(--ink), 0 10px 0 rgba(51,38,43,.22);
  animation: tma-pop-in .5s cubic-bezier(.3,1.5,.5,1) both; }
.papan p { margin: 0; font-size: clamp(24px, 3.2vw, 38px); font-weight: 800; line-height: 1.3; text-align: center; }
.papan-bawah { position: relative; flex: 1; min-height: 90px; width: 100%; }
.tiang { position: absolute; z-index: 1; left: 42%; top: -8px; bottom: 4%; width: 26px; margin-left: -13px; background: #B97A48; border: 5px solid var(--ink); border-top: 0; border-radius: 0 0 10px 10px; }
.pegang { position: absolute; z-index: 2; left: 42%; bottom: 0; height: min(100%, 330px); aspect-ratio: 240 / 300; transform: translateX(-71%); }
.pegang svg { width: 100%; height: 100%; display: block; }
.tangan { position: absolute; z-index: 4; left: 42%; bottom: calc(min(100%, 330px) * .22); width: clamp(22px, 3.4vh, 36px); aspect-ratio: 1; border-radius: 50%; border: 5px solid var(--ink); transform: translate(-50%, 50%); }
.pj-hias { position: absolute; left: 58%; bottom: 40%; width: clamp(48px, 9vh, 86px); animation: ayun 2.4s ease-in-out infinite; }
.pj-hias svg { width: 100%; height: auto; display: block; }
.kad-aksi { flex: none; display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; }
.kad-aksi .big-btn { background: var(--green); font-size: 28px; padding-right: 34px; }
.kad-aksi .big-btn svg { color: #fff; }
.kecil { display: inline-flex; align-items: center; gap: 6px; min-height: 88px; padding: 6px 24px 6px 16px; border-radius: 999px; border: 5px solid var(--ink);
  background: var(--orange); color: #fff; font-size: 24px; font-weight: 800; box-shadow: var(--bayang); text-shadow: 0 2px 0 rgba(51,38,43,.35); }
.kecil svg { width: 36px; height: 36px; }
.sp-kad { flex: 1; min-height: 0; width: min(1000px, 100%); display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); align-items: center; gap: clamp(14px, 3vw, 36px);
  padding: clamp(16px, 3vh, 30px) clamp(16px, 3vw, 36px); background: #fff; border: 6px solid var(--ink); border-radius: 34px; box-shadow: 0 10px 0 rgba(51,38,43,.22);
  animation: tma-pop-in .5s cubic-bezier(.3,1.5,.5,1) both; }
.sp-seni { position: relative; align-self: stretch; height: auto; min-height: 160px; border: 5px solid var(--ink); border-radius: 26px; overflow: hidden; background: var(--wl); }
.sp-pentas { position: absolute; inset: 0; }
.sp-pentas .adegan, .sp-pentas .prop { position: absolute; left: 0; top: 0; }
.sp-pentas .wt { cursor: pointer; }
.sp-w { flex: 1; max-width: 220px; margin: 0 -14px; }
.sp-w svg { width: 100%; height: auto; display: block; max-height: 30vh; }
.sp-hias { position: absolute; top: 8px; right: 10px; width: clamp(48px, 8vh, 74px); animation: ayun 2.4s ease-in-out infinite; }
.sp-hias svg { width: 100%; height: auto; display: block; }
.sp-teks { min-width: 0; }
.sp-frasa { margin: 0 0 10px; font-size: clamp(32px, 4.6vw, 58px); font-weight: 800; line-height: 1.05; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 10px; text-underline-offset: 2px; text-decoration-skip-ink: none; }
.sp-maksud, .sp-contoh { margin: 0 0 8px; font-size: clamp(19px, 2.2vw, 26px); font-weight: 600; line-height: 1.32; }
.sp-maksud b, .sp-contoh b { font-weight: 800; color: var(--w); filter: brightness(.75); }
.skrin-tamat.akhir { background: var(--w); }

/* ============ iPad potret ============ */
@media (orientation: portrait) {
  .rak { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kulit-buku { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .kb-seni { border-right: 0; border-bottom: 6px solid var(--ink); }
  .kb-kad { padding-bottom: 40px; }
  .kb-kad::before { width: auto; height: 18px; right: 0; bottom: auto; border-right: 0; border-bottom: 5px solid var(--ink); }
  .kb-pilih { flex-direction: row; flex-wrap: wrap; }
  .kb-btn { flex: 1 1 260px; justify-content: center; }
  .akt-kuiz { flex-wrap: wrap; align-content: center; }
  .pilihan { width: clamp(150px, 30vw, 300px); }
  .akt-padan { grid-template-columns: minmax(0, 1fr) minmax(60px, 16%) minmax(0, 1fr); }
  .pd-item { flex-direction: column; text-align: center; padding: 10px; } .pd-item.tx { min-height: clamp(96px, 16vh, 190px); }
  .sp-kad { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .sp-seni { max-height: none; height: 100%; }
}
@media (orientation: portrait) and (min-width: 700px) { .rak { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ============ telefon landskap ============ */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --kiri-selamat: 84px; }
  .ps-kepala { min-height: 70px; padding-top: calc(6px + var(--safe-t)); }
  .ps-kepala h1 { font-size: 28px; }
  .rak { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-top: 6px; }
  .buku { border-width: 4px; border-radius: 20px; }
  .kulit { border-bottom-width: 4px; }
  .buku-info { padding: 6px 8px 8px 10px; gap: 4px; }
  .buku-tajuk { font-size: 15px; }
  .bt svg { width: 17px; height: 17px; }
  .baca-pill { min-height: 44px; font-size: 15px; padding: 2px 12px 2px 6px; border-width: 3px; }
  .kb-kad { gap: 8px; padding: 12px 18px; }
  .kb-tajuk { font-size: 26px; } .kb-ringkas { font-size: 15px; }
  .kb-pilih { gap: 8px; }
  .kb-btn { min-height: 60px; font-size: 21px; border-width: 4px; padding: 4px 20px 4px 14px; } .kb-btn svg { width: 34px; height: 34px; }
  .kb-balik { min-height: 44px; font-size: 16px; }
  .bb-atas { top: calc(8px + var(--safe-t)); right: 8px; }
  .bb-tajuk { display: none; }
  .bb-mod { min-height: 48px; font-size: 15px; padding: 4px 14px 4px 10px; border-width: 3px; } .bb-mod svg { width: 26px; height: 26px; }
  .bb-bawah { padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 10px; border-top-width: 4px; }
  .kertas { min-height: 0; padding: 6px 70px 6px 14px; border-radius: 18px; border-width: 3px; }
  .teks { font-size: 18px; line-height: 1.35; }
  .dengar-btn { width: 56px; height: 56px; border-radius: 18px; font-size: 11px; border-width: 3px; right: 6px; } .dengar-btn svg { width: 26px; height: 26px; }
  .nav { width: 70px; height: 70px; border-radius: 24px; font-size: 13px; border-width: 4px; } .nav svg { width: 32px; height: 32px; }
  .bb-titik { padding: 3px 8px; gap: 5px; border-width: 3px; } .bb-titik i { width: 9px; height: 9px; } .bb-titik i.on { width: 18px; }
  .gelembung { font-size: 16px; padding: 6px 12px; border-width: 3px; }
  .tamat-tajuk { font-size: 60px; } .tw { width: min(92px, calc(94vw / var(--n, 2))); }
  .skrin-tamat .big-btn { min-height: 64px; font-size: 24px; }
  .skrin-akt { padding-top: calc(8px + var(--safe-t)); padding-bottom: 8px; }
  .akt-kepala { flex-direction: row; gap: 10px; padding: 0 84px; }
  .akt-langkah { flex-direction: column; gap: 4px; } .akt-langkah i { width: 28px; height: 28px; font-size: 14px; border-width: 3px; }
  .akt-soal { padding: 4px 6px 4px 14px; border-width: 4px; border-radius: 20px; } .akt-soal p { font-size: 18px; }
  .ulang-soal { width: 56px; height: 56px; border-radius: 16px; font-size: 11px; } .ulang-soal svg { width: 26px; height: 26px; }
  .akt-isi { margin-top: 8px; }
  .akt-kawan { width: 70px; }
  .akt-kuiz { padding-bottom: 6px; }
  .pilihan { width: 150px; padding: 6px; border-radius: 22px; border-width: 4px; } .pl-seni { width: 62%; } .pilihan b { font-size: 17px; }
  .slot-baris, .dulang { gap: 12px; } .akt-susun { gap: 10px; padding-bottom: 0; }
  .slot-no { width: 30px; height: 30px; font-size: 16px; left: -10px; top: -10px; border-width: 3px; }
  .pd-item { min-height: 54px; border-width: 4px; padding: 2px 12px 2px 6px; border-radius: 18px; } .pd-seni { width: 46px; } .pd-item b, .pd-item .gm-teks { font-size: 16px; }
  .akt-padan { padding-bottom: 6px; } .pd-lajur { gap: 8px; }
  .skrin-pengajaran, .skrin-simpulan { padding-top: calc(8px + var(--safe-t)); padding-bottom: 8px; gap: 8px; }
  .kad-label { font-size: 20px; padding: 2px 16px 2px 10px; border-width: 4px; } .kad-label svg { width: 26px; height: 26px; }
  .papan { padding: 10px 18px; } .papan p { font-size: 19px; }
  .pegang { width: 90px; }
  .kecil { min-height: 52px; font-size: 17px; border-width: 4px; padding: 4px 16px 4px 10px; } .kecil svg { width: 26px; height: 26px; }
  .kad-aksi .big-btn { font-size: 19px; min-height: 52px; }
  .kad-aksi { justify-content: flex-end; }
  .sp-kad { padding: 10px 16px; border-width: 4px; border-radius: 24px; gap: 14px; }
  .sp-frasa { font-size: 28px; text-decoration-thickness: 6px; } .sp-maksud, .sp-contoh { font-size: 15px; margin-bottom: 4px; }
  .sp-seni { padding: 10px 4px 4px; } .sp-w svg { max-height: 34vh; }
}
/* ============ telefon potret ============ */
@media (orientation: portrait) and (max-width: 500px) {
  :root { --kiri-selamat: 84px; }
  .ps-kepala { min-height: 84px; padding-left: 84px; padding-right: 12px; justify-content: flex-start; }
  .ps-kepala h1 { font-size: 27px; text-align: left; }
  .ps-kepala h1 span { display: block; }
  .rak { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-left: 12px; padding-right: 12px; }
  .buku { border-width: 4px; border-radius: 20px; }
  .buku-info { padding: 6px 8px 8px 10px; }
  .buku-tajuk { font-size: 16px; }
  .bt svg { width: 18px; height: 18px; }
  .baca-pill { font-size: 15px; padding: 2px 12px 2px 6px; border-width: 3px; }
  .kb-kad { gap: 10px; padding: 26px 16px 28px; }
  .kb-tajuk { font-size: 30px; } .kb-ringkas { font-size: 16px; }
  .kb-btn { min-height: 68px; font-size: 22px; } .kb-btn svg { width: 36px; height: 36px; }
  .bb-atas { top: calc(10px + var(--safe-t)); right: 10px; }
  .bb-tajuk { display: none; }
  .bb-mod { min-height: 52px; font-size: 15px; padding: 4px 14px 4px 10px; } .bb-mod svg { width: 28px; height: 28px; }
  .bb-bawah { grid-template-columns: auto 1fr auto; grid-template-areas: "k k k" "s . n"; padding: 16px 12px calc(14px + env(safe-area-inset-bottom, 0px)); gap: 10px; }
  .kertas { grid-area: k; padding: 8px 12px 8px 14px; min-height: 0; flex-direction: column; align-items: stretch; }
  .teks { font-size: 21px; }
  .dengar-btn { position: static; transform: none; align-self: flex-end; flex-direction: row; gap: 4px; width: auto; height: 48px; padding: 0 14px 0 10px; margin-top: 6px; border-radius: 999px; font-size: 15px; border-width: 3px; }
  .dengar-btn svg { width: 26px; height: 26px; }
  .dengar-btn:active { transform: translateY(3px); }
  .nav { width: auto; height: 64px; flex-direction: row; gap: 6px; padding: 0 18px 0 12px; border-radius: 999px; font-size: 18px; border-width: 4px; }
  .nav svg { width: 30px; height: 30px; }
  .nav.seterus { padding: 0 12px 0 18px; } .nav.seterus svg { order: 2; }
  .nav.tamat svg { order: -1; }
  .nav.sebelum { grid-area: s; } .nav.seterus { grid-area: n; }
  .gelembung { font-size: 17px; padding: 6px 12px; border-width: 3px; }
  .tamat-tajuk { font-size: 72px; } .tw { width: min(30vw, calc(96vw / var(--n, 2))); }
  .skrin-akt { padding-top: calc(12px + var(--safe-t)); }
  .akt-kepala { padding: 0; align-items: flex-end; }
  .akt-langkah { margin-right: 4px; } .akt-langkah i { width: 32px; height: 32px; font-size: 15px; }
  .akt-soal { margin-top: 18px; padding: 6px 6px 6px 14px; border-radius: 22px; align-self: stretch; } .akt-soal p { font-size: 20px; }
  .ulang-soal { width: 60px; height: 60px; border-radius: 18px; font-size: 11px; } .ulang-soal svg { width: 28px; height: 28px; }
  .akt-kawan { width: 76px; }
  .akt-kuiz { gap: 12px; padding-bottom: 70px; }
  .pilihan { width: calc(50% - 8px); padding: 8px; border-radius: 24px; }
  .slot-baris, .dulang { gap: 12px; } .akt-susun { padding-bottom: 60px; }
  .akt-padan { grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr); padding-bottom: 70px; }
  .pd-item { flex-direction: column; gap: 0; min-height: 64px; padding: 6px; border-width: 4px; border-radius: 20px; text-align: center; }
  .pd-seni { width: 56px; } .pd-item b { font-size: 15px; } .pd-item .gm-teks { font-size: 17px; }
  .kad-aksi .big-btn { font-size: 22px; min-height: 64px; } .kecil { min-height: 64px; font-size: 18px; }
  .papan p { font-size: 22px; }
  .sp-frasa { font-size: 32px; } .sp-maksud, .sp-contoh { font-size: 17px; }
  .sp-kad { gap: 10px; padding: 12px; } .sp-w svg { max-height: 22vh; }
}
@media (prefers-reduced-motion: reduce) {
  .awan > g, .putar, .goyang, .ayun, .ombak, .kelip, .kunang, .lebah, .sinar, .riak, .nav.tamat, .skrin-tamat .big-btn { animation: none !important; }
  .selak { animation-duration: .01s !important; }
}

/* Audit UI Okt 2026: "Pilih cerita lain" = butang sebenar (bukan teks kelabu kecil) — anak nampak jalan balik ke rak */
.kb-balik { min-height: 60px; padding: 4px 20px 4px 10px; margin-left: 0; background: #fff; border: 4px solid var(--ink); border-radius: 999px; color: var(--ink);
  box-shadow: 0 5px 0 rgba(51,38,43,.2); cursor: pointer; }
.kb-balik svg { color: var(--ink); width: 28px; height: 28px; }
.kb-balik:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(51,38,43,.2); }
@media (max-width: 599px), (max-height: 599px) { .kb-balik { min-height: 52px; font-size: 16px; } }

/* tutorial kali pertama (tangan tunjuk contoh): jari anak diabaikan semasa demo */
body.tutorial .akt-isi, body.tutorial .ulang-soal { pointer-events: none; }
.pilihan.demo-tunjuk { transform: scale(1.05); box-shadow: 0 0 0 6px #FFD23F, 0 8px 0 6px rgba(51,38,43,.22); }
