/* =====================================================================
   Petualangan Rukun Islam v2.1 — gaya "Buku Cerita Taman"
   Kertas buram + garis tinta 3px + bayangan keras. Tanpa gradien di UI,
   tanpa panel kaca gelap, tanpa garis warna di kiri kartu.
   Semua ukuran memakai rem (1rem = --fs) agar mode "Huruf lebih besar" bekerja.
   ===================================================================== */

/* ---------- Huruf (self-hosted, SIL OFL 1.1 — lisensi di fonts/) ---------- */
@font-face { font-family: 'Andika'; src: url(../fonts/andika-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Andika'; src: url(../fonts/andika-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url(../fonts/fredoka-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url(../fonts/fredoka-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Scheherazade New'; src: url(../fonts/scheherazade-new-arabic-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Scheherazade New'; src: url(../fonts/scheherazade-new-arabic-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }

/* ---------- Token ---------- */
:root {
  /* tinta & kertas */
  --ink: #2B2340;
  --ink-2: #4E4566;
  --paper: #FFF9EF;
  --paper-2: #FBEEDC;
  --paper-3: #F3E3CC;
  --white: #FFFFFF;
  --placeholder: #6E6585;
  --line-soft: #8A8099;

  /* pastel */
  --peach: #FFD9C4;
  --apricot: #FFB27A;
  --apricot-2: #FF9E5E;
  --mint: #C3EED8;
  --mint-deep: #17734B;
  --butter: #FFEBA3;
  --sky: #CFE5FF;
  --lav: #E6DDFF;
  --rose: #FFD0D8;
  --rose-deep: #A8213B;
  --veil: rgba(76, 58, 110, .38);

  /* lima rukun: pastel / tengah / gelap */
  --r1: #BFEBDD; --r1m: #33A97F; --r1d: #145C45;
  --r2: #CBE4FF; --r2m: #5AAEF2; --r2d: #1D4F8C;
  --r3: #FFE7A0; --r3m: #EDB02A; --r3d: #6E4B00;
  --r4: #E2D6FF; --r4m: #5E45B5; --r4d: #4B3496;
  --r5: #FFD3C4; --r5m: #D9603F; --r5d: #8F3418;

  /* bentuk */
  --bw: 3px;
  --line: var(--bw) solid var(--ink);
  --lift: 0 5px 0 var(--ink);
  --lift-sm: 0 4px 0 rgba(43, 35, 64, .9);
  --lift-panel: 0 8px 0 rgba(43, 35, 64, .9), 0 14px 30px rgba(43, 35, 64, .22);
  --press: 0 1px 0 var(--ink);
  --r-panel: 26px; --r-btn: 18px; --r-card: 22px; --r-pill: 999px;

  /* huruf */
  --f-body: 'Andika', 'Scheherazade New', 'Trebuchet MS', system-ui, sans-serif;
  --f-head: 'Fredoka', 'Andika', system-ui, sans-serif;
  --f-ar: 'Scheherazade New', 'Amiri', 'Noto Naskh Arabic', serif;
  --fs: 18px;

  /* ikon buku (warna --r2d) untuk <cite> di konten */
  --ic-buku: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.5 5.5c3-1 6-1 8.5 1 2.5-2 5.5-2 8.5-1v13c-3-1-6-1-8.5 1-2.5-2-5.5-2-8.5-1z' fill='none' stroke='%231D4F8C' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M12 6.5v13' stroke='%231D4F8C' stroke-width='2.2'/%3E%3C/svg%3E");
}
html.big-text { --fs: 21px; }

/* warna per rukun: .rk1 ... .rk5 */
.rk1 { --rp: var(--r1); --rm: var(--r1m); --rd: var(--r1d); }
.rk2 { --rp: var(--r2); --rm: var(--r2m); --rd: var(--r2d); }
.rk3 { --rp: var(--r3); --rm: var(--r3m); --rd: var(--r3d); }
.rk4 { --rp: var(--r4); --rm: var(--r4m); --rd: var(--r4d); }
.rk5 { --rp: var(--r5); --rm: var(--r5m); --rd: var(--r5d); }

/* ---------- Dasar ---------- */
* { box-sizing: border-box; }
html { font-size: var(--fs); }
html, body { margin: 0; height: 100%; overflow: hidden; background: #A8DBF7; color: var(--ink);
  font-family: var(--f-body); line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { font-size: 1rem; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
b, strong { font-weight: 700; }
em, i, cite { font-style: normal; }
.hidden, [hidden] { display: none !important; }
svg.i { width: 1em; height: 1em; vertical-align: -.14em; flex: none; display: inline-block; }
:focus { outline: none; }
:focus-visible { outline: 4px dashed var(--r2d); outline-offset: 5px; }
#panel:focus, #panel:focus-visible { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0; }
/* ﷺ: dibesarkan agar terbaca (teks konten tetap sama) */
.saw { font-family: var(--f-ar); font-size: 1.6em; line-height: 1; vertical-align: -.2em; font-weight: 400; }

small { font-size: .945rem; }
.ar { font-family: var(--f-ar); direction: rtl; font-weight: 400; line-height: 1.9; color: var(--ink); }

/* tutup tombol keyboard (dekoratif, 16px) */
.kbd { display: inline-block; min-width: 30px; text-align: center; font: 700 16px/1 var(--f-body); color: var(--ink);
  background: var(--white); border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 8px; padding: 4px 8px; }

@keyframes pop { from { transform: scale(.85) translateY(8px); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- Medali (lingkaran ikon rukun) ---------- */
.med { --ms: 50px; position: relative; flex: none; width: var(--ms); height: var(--ms); border-radius: 50%; border: var(--line);
  background: var(--rp, var(--paper)); color: var(--rm, var(--ink)); display: grid; place-items: center; font-size: calc(var(--ms) * .6); }
.med > svg.i { vertical-align: 0; }
.med.locked { background: var(--paper-2); border-style: dashed; color: var(--placeholder); font: 700 1.111rem/1 var(--f-head); }
.med.allok { background: var(--mint); color: var(--mint-deep); }
.b-ok, .b-num { position: absolute; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; }
.b-ok { right: -6px; bottom: -6px; background: var(--mint-deep); color: var(--white); font-size: 14px; }
.b-num { left: -8px; top: -8px; background: var(--rd, var(--ink)); color: var(--white); font: 700 17px/1 var(--f-head); }

/* ---------- Tombol ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 22px;
  font: 600 1.111rem/1.05 var(--f-head); letter-spacing: .01em; color: var(--ink); text-align: center;
  background: var(--paper); border: var(--line); border-radius: var(--r-btn); box-shadow: var(--lift); cursor: pointer;
  transition: transform .06s, box-shadow .06s, background-color .12s; }
.btn > svg.i { font-size: 1.15em; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: var(--press); }
.btn.primary { background: var(--apricot); font-size: 1.333rem; min-height: 64px; padding: 0 28px; }
.btn.secondary { background: var(--sky); }
.btn.info { background: var(--lav); }
.btn.danger { background: var(--rose); }
.btn.butter { background: var(--butter); }
.btn.quiet { background: var(--paper-2); box-shadow: 0 4px 0 rgba(43, 35, 64, .35); }
.btn.back > svg.i { transform: scaleX(-1); }
.btn.small { min-height: 50px; font-size: 1rem; padding: 0 16px; }
.btn:disabled { background: var(--paper-3); color: var(--ink-2); box-shadow: none; cursor: default; }
@media (hover: hover) {
  .btn:hover { background: var(--paper-2); }
  .btn.primary:hover { background: var(--apricot-2); }
  .btn.secondary:hover { background: #B9D8FF; }
  .btn.info:hover { background: #D5C8FB; }
  .btn.danger:hover { background: #FFBDC8; }
  .btn.butter:hover { background: #FFE07A; }
  .btn.quiet:hover { background: var(--paper-3); }
  .icon-btn:hover { background: var(--paper-2); }
}
.icon-btn { width: 56px; height: 56px; border-radius: 50%; border: var(--line); background: var(--paper); box-shadow: var(--lift);
  display: grid; place-items: center; color: var(--ink); font-size: 26px; padding: 0; cursor: pointer; }
.icon-btn:active { transform: translateY(4px); box-shadow: var(--press); }

/* chip rujukan (juga untuk <cite> di konten) */
.ref-chip, .panel-body cite { display: inline-flex; align-items: center; gap: 8px; font: 700 .945rem/1.3 var(--f-body); color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 20px; padding: 4px 14px 4px 10px; text-decoration: none; vertical-align: middle; }
.ref-chip > svg.i { font-size: 1.15em; color: var(--r2d); }
a.ref-chip { min-height: 48px; }
.panel-body cite { margin-top: 4px; }
.panel-body cite::before { content: ''; width: 1.15em; height: 1.15em; flex: none; background: var(--ic-buku) center / contain no-repeat; }

/* =====================================================================
   Label dunia 3D — pil kertas
   ===================================================================== */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.wlabel { position: absolute; left: 0; top: 0; white-space: nowrap; text-align: center; will-change: transform;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 4px 12px;
  font: 600 1rem/1.15 var(--f-head); box-shadow: 0 3px 0 rgba(43, 35, 64, .85); }
.wlabel b { font-weight: 600; }
.wlabel small { display: block; font: 400 .945rem/1.3 var(--f-body); color: var(--ink-2); white-space: normal; }
.wlabel .ar { display: block; font-size: 1.45em; line-height: 1.6; }
.wlabel .num { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 6px; border-radius: 50%; flex: none;
  background: var(--rd); color: var(--white); border: 2px solid var(--ink); font: 700 17px/1 var(--f-head); }
.wlabel .lab-ic { color: var(--rm); margin-right: 6px; font-size: 22px; }
.wlabel.gate { font-size: 1.111rem; display: flex; align-items: center; padding: 4px 16px 4px 5px; }
.wlabel.gate.locked { background: var(--paper-2); color: var(--ink-2); }
.wlabel.gate.locked .num { background: var(--placeholder); }
.wlabel.gate.locked .lab-ic { color: var(--placeholder); }
.wlabel.pillar { display: flex; align-items: center; font-size: .945rem; padding: 3px 12px 3px 4px; }
.wlabel.pillar.lit { background: var(--rp); }
.wlabel.sign { border-radius: 12px; border-width: 2.5px; white-space: nowrap; padding: 4px 10px; font-size: .945rem; }
.wlabel.sign small { display: none; }
.wlabel.sign.open { width: 210px; white-space: normal; padding: 6px 10px; }
.wlabel.sign.open small { display: block; font: 400 .9rem/1.3 var(--f-body); color: var(--ink); }
.wlabel.sign b { display: block; margin-bottom: 2px; }
.wlabel.tablet { border-radius: 18px; border-width: 3px; max-width: 460px; white-space: normal; padding: 8px 16px; }
.wlabel.tablet small { font: 700 1rem/1.35 var(--f-body); color: var(--ink); }
.wlabel.orb { background: var(--butter); padding: 2px 14px 6px; }
.wlabel.orb .ar { font-size: 1.4em; }
.wlabel.good { background: var(--mint); }
.wlabel.bad { background: var(--rose); }
.wlabel.good svg.i, .wlabel.bad svg.i { margin-right: 4px; font-size: 18px; vertical-align: -3px; }
.wlabel.good svg.i { color: var(--mint-deep); }
.wlabel.bad svg.i { color: var(--rose-deep); }
.wlabel.bad small { color: var(--rose-deep); font-weight: 700; }

/* =====================================================================
   HUD
   ===================================================================== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-btn, #prompt { pointer-events: auto; }

/* progres lima rukun */
#progress { position: absolute; left: calc(18px + env(safe-area-inset-left)); top: max(16px, env(safe-area-inset-top)); }
.hud-cap { display: inline-block; font: 600 1rem/1 var(--f-head); background: var(--ink); color: var(--paper);
  padding: 7px 14px 9px; border-radius: 12px 12px 0 0; margin-left: 14px; }
#chips { display: flex; gap: 8px; background: rgba(255, 249, 239, .92); border: 2.5px solid var(--ink); border-radius: 22px; padding: 9px; }
/* cincin rukun aktif: warna gelap rukun (>= 7:1 di atas kertas) */
.chip.active { box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--rd); animation: bob 1.6s ease-in-out infinite; }

/* papan tujuan + kompas */
#sign { position: absolute; left: 50%; top: max(0px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(500px, 42vw);
  padding-top: 14px; display: flex; flex-direction: column; align-items: center; }
#sign::before, #sign::after { content: ''; position: absolute; top: 0; width: 3px; height: 20px; background: var(--ink); }
#sign::before { left: 22%; } #sign::after { right: 22%; }
/* papan kayu yang digantung: serat kayu + dua paku di tempat tali */
#objective { position: relative; width: 100%; display: flex; align-items: center; gap: 14px; border: var(--line); border-radius: 18px;
  padding: 14px 14px 12px 12px; box-shadow: var(--lift-sm);
  background-color: #F8DFB4;
  background-image:
    radial-gradient(circle at 22% 8px, var(--ink) 0 3px, #A9825A 3.2px 4.5px, transparent 5px),
    radial-gradient(circle at 78% 8px, var(--ink) 0 3px, #A9825A 3.2px 4.5px, transparent 5px),
    repeating-linear-gradient(176deg, transparent 0 11px, rgba(150, 98, 44, .13) 11px 13px, transparent 13px 23px, rgba(150, 98, 44, .07) 23px 24px, transparent 24px 34px); }
.replay { flex: none; align-self: center; width: 48px; height: 48px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper);
  color: var(--ink); display: grid; place-items: center; font-size: 22px; padding: 0; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.replay:active { transform: translateY(3px); box-shadow: none; }
@media (hover: hover) { .replay:hover { background: var(--paper-2); } }
#objMed { --ms: 58px; }
.obj-txt { min-width: 0; flex: 1; }
#objTitle { font: 600 1.278rem/1.15 var(--f-head); }
#objBody { font-size: 1rem; color: var(--ink-2); line-height: 1.35; margin-top: 2px; }
#objBody:empty { display: none; }
#objBody b { color: var(--ink); }
#objBody .hint { display: block; font-size: .945rem; margin-top: 4px; }

/* urutan (syahadat, waktu shalat) */
.seq { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.seq > span { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-pill); border: 2px solid var(--ink);
  padding: 2px 10px; font: 700 .945rem/1.3 var(--f-body); color: var(--ink); background: var(--paper); }
.seq .ok { background: var(--mint); }
.seq .ok svg.i { color: var(--mint-deep); }
.seq .now { background: var(--butter); font-family: var(--f-head); font-weight: 600; animation: bob 1.6s ease-in-out infinite; }
.seq .todo { border: 2px dashed var(--line-soft); color: var(--ink-2); }
.seq .more, .seq .okn { display: none; border: 2px dashed var(--line-soft); color: var(--ink-2); background: var(--paper); }
.seq .okn { border: 2px solid var(--ink); background: var(--mint); color: var(--ink); }
.seq .okn svg.i { color: var(--mint-deep); }

/* titik hitung (zakat, amal baik, tawaf, sa'i) */
.pips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 4px; }
.pips > i { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper); display: grid; place-items: center; font-size: 16px; }
.pips > i.on { background: var(--rm, var(--mint-deep)); color: var(--white); }
.rk3 .pips > i.on { color: var(--ink); }
.pips > span { margin-left: 4px; font: 700 .945rem/1.3 var(--f-body); color: var(--ink); }
.hearts { display: flex; align-items: center; gap: 3px; margin-top: 4px; }
.hearts svg.i { font-size: 24px; }
.hearts span { margin-left: 4px; font: 700 .945rem/1.3 var(--f-body); color: var(--ink); }
.bar { display: block; width: 100%; max-width: 280px; height: 10px; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-pill); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--r5m); }

#compass { margin-top: 10px; display: flex; align-items: center; gap: 10px; background: var(--butter); border: 2.5px solid var(--ink); border-radius: var(--r-pill);
  padding: 4px 18px 4px 5px; font: 700 1.167rem/1 var(--f-head); white-space: nowrap; max-width: 100%; }
#compass .dial { width: 44px; height: 44px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--ink); display: grid; place-items: center; flex: none; }
#arrow { font-size: 32px; color: var(--r3m); transition: transform .08s linear; vertical-align: 0; }
#cdist small { font: 400 .945rem/1 var(--f-body); color: var(--ink-2); margin-left: 6px; }

/* menu & keluar */
.hud-right { position: absolute; right: calc(18px + env(safe-area-inset-right)); top: max(16px, env(safe-area-inset-top));
  display: flex; flex-direction: column; align-items: center; gap: 4px; }
.menu-lbl { font: 600 .945rem/1 var(--f-head); background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 3px 10px; }
#exitBtn { position: absolute; right: calc(90px + env(safe-area-inset-right)); top: max(20px, env(safe-area-inset-top)); }

/* tombol aksi kontekstual */
#prompt { position: absolute; left: 50%; bottom: calc(34px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); }
#promptBtn { font-size: 1.278rem; min-height: 66px; padding: 0 14px 0 24px; gap: 14px; }
#promptBtn > svg.i { font-size: 1.3em; }
#promptBtn .kbd { font-size: 20px; padding: 6px 12px; background: var(--paper); }
body.touch #prompt { display: none; }

/* bantuan keyboard */
#help { position: absolute; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); background: rgba(255, 249, 239, .9); border: 2px solid var(--ink);
  border-radius: 18px; padding: 10px 14px; display: grid; gap: 6px; font-size: .945rem; color: var(--ink); }
#help div { display: flex; align-items: center; gap: 6px; }
body.touch #help { display: none; }

/* =====================================================================
   Kontrol sentuh
   ===================================================================== */
#joy { position: fixed; left: calc(18px + env(safe-area-inset-left)); bottom: calc(22px + env(safe-area-inset-bottom)); width: 142px; height: 142px;
  border-radius: 50%; background: rgba(255, 249, 239, .85); border: var(--line); box-shadow: var(--lift); z-index: 6; touch-action: none; }
#joy .notches { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--ink-2); }
#knob { position: absolute; left: 50%; top: 50%; width: 66px; height: 66px; margin: -33px 0 0 -33px; border-radius: 50%; background: var(--sky);
  border: var(--line); box-shadow: 0 4px 0 var(--ink), inset 0 -6px 0 rgba(43, 35, 64, .12); }
#actionBtn { position: fixed; right: calc(22px + env(safe-area-inset-right)); bottom: calc(30px + env(safe-area-inset-bottom)); width: 104px; height: 104px;
  border-radius: 50%; border: var(--line); background: var(--paper-2); color: var(--ink-2); z-index: 6; touch-action: manipulation; padding: 0;
  display: grid; place-items: center; align-content: center; gap: 2px; font: 700 1.167rem/1 var(--f-head); cursor: pointer; box-shadow: 0 4px 0 rgba(43, 35, 64, .35); }
#actionBtn > svg.i { font-size: 36px; opacity: .55; }
#actionBtn.ready { background: var(--apricot); color: var(--ink); box-shadow: 0 6px 0 var(--ink); animation: bob 1.6s ease-in-out infinite; }
#actionBtn.ready > svg.i { opacity: 1; }
#actionBtn:active { transform: translateY(4px); box-shadow: var(--press); animation: none; }

/* =====================================================================
   Toast: balon bicara
   ===================================================================== */
#toasts { position: fixed; left: calc(24px + env(safe-area-inset-left)); top: 210px; width: min(470px, 40vw); z-index: 7;
  display: flex; flex-direction: column; gap: 14px; align-items: stretch; pointer-events: none; }
.toast { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1) both;
  transition: opacity .35s, transform .35s; pointer-events: auto; cursor: pointer; }
.toast.out { opacity: 0; transform: translateY(-8px) scale(.96); pointer-events: none; }
/* balon pesan = sekunder: garis 2.5px, tanpa bayangan keras */
.t-ic { width: 56px; height: 56px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 28px; }
.t-txt { position: relative; background: var(--tbg); border: 2.5px solid var(--ink); border-radius: 22px; padding: 12px 18px; font: 400 1.056rem/1.4 var(--f-body);
  color: var(--ink); }
.t-txt::before { content: ''; position: absolute; left: -13px; top: 50%; margin-top: -11px; width: 22px; height: 22px; background: var(--tbg);
  border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); border-radius: 0 0 0 4px; }
.t-h { display: block; font: 600 1.111rem/1.2 var(--f-head); margin-bottom: 2px; }
.t-txt .ar { display: block; text-align: right; font-size: 1.45em; line-height: 1.6; }
.toast.good { --tbg: var(--mint); } .toast.good .t-ic { background: var(--mint-deep); color: var(--white); }
.toast.warn { --tbg: var(--butter); } .toast.warn .t-ic { background: var(--apricot); color: var(--ink); }
.toast.info { --tbg: var(--sky); } .toast.info .t-ic { background: var(--paper); color: var(--r2d); }
.toast.bad { --tbg: var(--rose); } .toast.bad .t-ic { background: var(--rose-deep); color: var(--white); }
/* salam/ajakan mulai: bukan tanda "benar", jadi tanpa centang */
.toast.hello { --tbg: var(--lav); } .toast.hello .t-ic { background: var(--paper); color: var(--ink); }

/* HUD ringkas (HP, layar pendek, huruf besar di layar sedang): 1 balon ramping di bawah papan */
body.hud-compact #toasts { left: 50%; right: auto; transform: translateX(-50%); width: min(560px, calc(100vw - 20px)); bottom: auto; gap: 8px; }
body.hud-compact.toasting:not(.hud-land) #compass { visibility: hidden; }
.hud-compact .toast { grid-template-columns: 42px 1fr; gap: 10px; }
.hud-compact .t-ic { width: 42px; height: 42px; font-size: 22px; }
.hud-compact .t-txt { padding: 8px 12px; font-size: .945rem; line-height: 1.3; }
.hud-compact .t-txt::before { width: 16px; height: 16px; left: -10px; margin-top: -8px; }
.hud-compact .t-h { display: inline; font-size: 1rem; margin: 0; }
.hud-compact .t-txt .ar { display: none; }
.hud-compact #objBody > .ob-t, .hud-compact #objBody .hint { display: none; }
.seq .ok, .seq .todo, .seq .more, .seq .okn { display: none; } /* papan cukup menampilkan langkah sekarang; jumlahnya ada di baris hint */
.hud-compact .replay { width: 44px; height: 44px; font-size: 20px; }

/* =====================================================================
   Overlay & panel
   ===================================================================== */
#overlay { position: fixed; inset: 0; z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr); place-items: safe center; overflow: auto; overscroll-behavior: contain;
  padding: 40px 20px 20px; background: var(--veil); -webkit-backdrop-filter: blur(3px) saturate(.9); backdrop-filter: blur(3px) saturate(.9); }
.panel { width: min(740px, 100%); background: var(--paper); border: var(--line); border-radius: var(--r-panel); box-shadow: var(--lift-panel);
  padding: 0 34px 24px; position: relative; color: var(--ink); animation: pop .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.panel-top { display: flex; align-items: flex-start; gap: 12px; }
.panel-top .grow { flex: 1; }
.panel-tab { --tab-bg: var(--sky); flex: none; white-space: nowrap; position: relative; margin-top: -22px; display: inline-flex; align-items: center; gap: 10px;
  background: var(--tab-bg); border: var(--line); border-radius: 16px; padding: 6px 16px 6px 8px; font: 600 1.111rem/1.1 var(--f-head); box-shadow: var(--lift-sm); max-width: 100%; }
.panel-tab.rkt { --tab-bg: var(--rp); }
.panel-tab.yakin { --tab-bg: var(--butter); }
.panel-tab .med { --ms: 36px; border-width: 2.5px; background: var(--paper); font-size: 20px; }
.steps { display: flex; align-items: center; gap: 7px; margin-top: 18px; font: 400 .945rem/1 var(--f-body); color: var(--ink-2); white-space: nowrap; }
.steps i { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper); }
.steps i.d { background: var(--rm, var(--r2m)); }
.steps i.c { width: 20px; height: 20px; background: var(--butter); }
.steps span { margin-left: 4px; }
.panel .speak { width: 52px; height: 52px; font-size: 24px; margin-top: 16px; flex: none; }
.panel h2#panelTitle:not(.panel-tab) { margin: 14px 0 12px; font: 600 1.556rem/1.2 var(--f-head); text-align: left; color: var(--ink); }
/* judul di tab (tanpa diulang di bawahnya) */
h2.panel-tab { margin-bottom: 0; white-space: normal; font-size: 1.278rem; }
.panel-top:has(h2.panel-tab) + .panel-body { margin-top: 16px; }
.panel-body p.ar .kal { display: inline-block; }
.hadith .gloss { color: var(--ink-2); }
.panel-body { font-size: 1rem; }
.panel-body p { margin: .5em 0; line-height: 1.5; }
.panel-body ul { margin: .4em 0; padding-left: 1.3em; }
.panel-body li { margin: .25em 0; }
.panel-body > p.ar { display: block; font-size: 1.6em; text-align: center; margin: .2em 0; }
.panel-body .la { text-align: center; font-weight: 700; }
.panel-body blockquote { position: relative; margin: 24px 0 14px; padding: 14px 18px; background: var(--white); border: 2.5px solid var(--ink); border-radius: 20px; }
.panel-body blockquote::before { content: ''; position: absolute; left: 30px; top: -14px; width: 22px; height: 22px; background: var(--white);
  border-left: 2.5px solid var(--ink); border-top: 2.5px solid var(--ink); transform: rotate(45deg); border-radius: 4px 0 0 0; }
.panel-body blockquote .ar { display: block; text-align: center; font-size: 1.45em; line-height: 1.8; margin-bottom: 4px; }
.panel-body blockquote .ar + br { display: none; }
.panel-body blockquote cite { display: flex; width: max-content; max-width: 100%; margin-top: 8px; }
.panel-body p.small, .note { background: var(--paper-2); border-radius: 16px; padding: 10px 14px; font-size: .945rem; color: var(--ink-2); line-height: 1.4; }
.note b { color: var(--ink); }
.note svg.i { color: var(--r2d); margin-right: 4px; }

.mission { margin-top: 16px; background: var(--butter); border: 2.5px solid var(--ink); border-radius: 20px; padding: 12px 16px; }
.mission-h { display: flex; align-items: center; gap: 8px; font: 600 1.111rem/1.2 var(--f-head); margin-bottom: 4px; }
.mission-h svg.i { color: var(--r3m); font-size: 1.2em; transform: rotate(90deg); }

/* tabel waktu shalat */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0 8px; margin: 4px 0; }
.tbl th { text-align: left; font: 600 1rem/1.2 var(--f-head); color: var(--ink-2); padding: 0 12px; }
.tbl th:nth-child(2) { text-align: center; }
.tbl td { background: var(--paper-2); padding: 8px 12px; vertical-align: middle; line-height: 1.35; }
.tbl td:first-child { border-radius: 14px 0 0 14px; font-weight: 700; }
.tbl td:last-child { border-radius: 0 14px 14px 0; }
.tbl td:nth-child(2) { text-align: center; }
.tbl td.rk-n span { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--sky); border: 2.5px solid var(--ink); font: 700 1.111rem/1 var(--f-head); }

/* aksi panel: utama di kanan (desktop; juga terakhir di DOM), pertama (HP) */
.panel-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: flex-end; margin-top: 20px; }
/* panel panjang: tombol tetap terlihat di bawah layar */
.panel:not(.title-panel):not(.pause):not(.ask) > .panel-actions { position: sticky; bottom: 0; z-index: 2; background: var(--paper);
  margin: 18px -34px -24px; padding: 16px 34px 24px; border-top: 2px dashed rgba(43, 35, 64, .28); border-radius: 0 0 23px 23px; }
.panel-actions:not(:has(.btn:not([hidden]))) { display: none !important; }
/* menu jeda: banyak tombol -> kisi 2 kolom, tombol utama selebar panel di atas */
.panel.pause .panel-actions { display: grid; grid-template-columns: 1fr 1fr; }
.panel.pause .panel-actions .btn.primary { grid-column: 1 / -1; }
.panel.finish .panel-actions { display: grid; grid-template-columns: 1fr 1fr; }
.panel.finish .panel-actions .btn.primary { grid-column: 1 / -1; }

/* skor */
.score { text-align: center; margin: 8px 0; }
.score .big { display: block; font: 700 2.444rem/1.1 var(--f-head); }
.score .dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.score .dots i { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--ink-2); background: var(--paper); }
.score .dots i.on { background: var(--mint-deep); border-color: var(--ink); }

/* daftar lima rukun (menu jeda & akhir) */
.rukun-list { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.rukun-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-width: 0; background: var(--paper-2); border-radius: 18px; padding: 8px 12px; }
.rukun-list .st { margin-left: auto; }
.rukun-list .med { --ms: 42px; font-size: 24px; }
.rukun-list .med.locked { font-size: 1.111rem; }
.rukun-list .nm { flex: 1 0 auto; max-width: 100%; font: 600 1.111rem/1.2 var(--f-head); }
.rukun-list .nm small { font: 400 .945rem/1 var(--f-body); color: var(--ink-2); margin-left: 6px; }
.st { font: 700 .945rem/1.2 var(--f-body); border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 4px 12px; background: var(--paper); white-space: nowrap; }
.st.ok { background: var(--mint); color: var(--mint-deep); }
.st.open { background: var(--sky); color: var(--r2d); }
.st.lock { background: var(--paper-3); color: var(--ink-2); border-style: dashed; }

/* sertifikat (layar akhir) */
.cert { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0 10px; }
.cert > svg { width: 72px; height: 72px; flex: none; }
.cert-name { margin: 0; font: 700 2.444rem/1.1 var(--f-head); background: var(--butter); border: var(--line); border-radius: var(--r-pill); padding: 6px 26px 10px;
  overflow-wrap: anywhere; max-width: 100%; min-width: 0; text-align: center; }
.finish .score { margin: 4px 0; }
.finish .score .big { font-size: 2rem; }
.medals { list-style: none; padding: 0; margin: 10px 0 4px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.medals li { display: grid; justify-items: center; gap: 4px; text-align: center; min-width: 0; }
.medals .med { --ms: 52px; font-size: 30px; }
.medals b { font: 600 1rem/1.1 var(--f-head); }
.medals small { font-size: .945rem; color: var(--ink-2); }

/* =====================================================================
   Layar judul = buku terbuka
   ===================================================================== */
.panel.title-panel { width: min(1100px, 100%); padding: 0; background: none; border: 0; box-shadow: none; animation: none; }
.book { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); filter: drop-shadow(0 10px 0 rgba(43, 35, 64, .9)) drop-shadow(0 22px 40px rgba(43, 35, 64, .3)); }
.page { position: relative; border: var(--line); padding: 30px 36px 24px; }
.page.l { background: var(--peach); border-radius: 30px 6px 6px 30px; border-right-width: 1.5px; }
.page.r { background: var(--paper); border-radius: 6px 30px 30px 6px; border-left-width: 1.5px; display: flex; flex-direction: column; }
.page.l::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 26px; background: linear-gradient(90deg, transparent, rgba(43, 35, 64, .10)); border-radius: 0 6px 6px 0; pointer-events: none; }
.page.r::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 22px; background: linear-gradient(270deg, transparent, rgba(43, 35, 64, .07)); pointer-events: none; }
.bunting { position: absolute; top: -3px; left: 40px; right: 40px; height: 44px; display: flex; justify-content: space-between; pointer-events: none; }
.bunting::before { content: ''; position: absolute; left: -10px; right: -10px; top: 6px; height: 20px; border-top: 3px solid var(--ink); border-radius: 50%; }
.flag { width: 34px; height: 38px; margin-top: 7px; clip-path: polygon(0 0, 100% 0, 50% 100%); background: var(--ink); position: relative; }
.flag::after { content: ''; position: absolute; inset: 3px 3px 6px 3px; clip-path: polygon(0 0, 100% 0, 50% 100%); background: var(--c); }
.book h1 { font: 700 2.889rem/1.02 var(--f-head); margin: 30px 0 4px; letter-spacing: -.01em; }
.book h1 span { display: block; font-size: 1.667rem; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-bottom: 4px; }
.lead { font-size: 1rem; margin: 8px 0 20px; line-height: 1.45; }
.lead p { margin: 0 0 .35em; }
.hadith { position: relative; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 22px; padding: 14px 20px 16px; }
.hadith::before { content: ''; position: absolute; left: 34px; top: -14px; width: 24px; height: 24px; background: var(--paper);
  border-left: 2.5px solid var(--ink); border-top: 2.5px solid var(--ink); transform: rotate(45deg); border-radius: 4px 0 0 0; }
.hadith .ar { margin: 0; font-size: 1.389rem; line-height: 1.75; text-align: center; }
.hadith .tr { font-size: 1rem; margin: 4px 0 10px; }
.five { display: flex; gap: 8px; margin-top: 16px; justify-content: space-between; }
.five figure { margin: 0; display: grid; justify-items: center; gap: 4px; font: 600 .945rem/1 var(--f-head); }
.five .med { --ms: 52px; font-size: 30px; }
.name-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 10px; }
.name-row .speak { margin: 0; }
.field-l { display: block; font: 600 1.222rem/1.2 var(--f-head); }
#nameInput { width: 100%; height: 60px; padding: 0 18px; font: 400 1.222rem/1 var(--f-body); color: var(--ink); background: var(--white);
  border: var(--line); border-radius: 16px; box-shadow: inset 0 4px 0 rgba(43, 35, 64, .07); }
#nameInput::placeholder { color: var(--placeholder); opacity: 1; }
.avatar-pick { border: 0; margin: 14px 0 18px; padding: 0; min-width: 0; }
.avatar-pick legend { padding: 0; font: 600 1.222rem/1.2 var(--f-head); margin-bottom: 10px; }
.avatar-pick .pick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.who { position: relative; border: var(--line); border-radius: var(--r-card); background: var(--paper-2); padding: 14px 10px 12px; display: grid;
  justify-items: center; gap: 6px; font: 600 1.111rem/1.1 var(--f-head); cursor: pointer; box-shadow: 0 4px 0 rgba(43, 35, 64, .25); text-align: center; }
.who > svg { width: 82px; height: 82px; }
.who input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.who .tick { display: none; position: absolute; top: -14px; right: -14px; width: 40px; height: 40px; border-radius: 50%; background: var(--mint-deep);
  color: var(--white); border: var(--line); place-items: center; font-size: 22px; }
.who:has(input:checked) { background: var(--mint); box-shadow: var(--lift); }
.who:has(input:checked) .tick { display: grid; }
.who:has(input:focus-visible) { outline: 4px dashed var(--r2d); outline-offset: 5px; }
@media (hover: hover) { .who:hover { background: var(--paper-3); } .who:has(input:checked):hover { background: var(--mint); } }
.title-panel .panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 0; }
.title-panel .panel-actions .btn { padding: 0 14px; }
.title-panel .panel-actions .primary { grid-column: 1 / -1; order: -1; }
.title-panel .note { margin: 14px 0 0; }
.keys-wrap { margin-top: auto; padding-top: 14px; }
.keys-note { padding-top: 12px; border-top: 2px dashed rgba(43, 35, 64, .3); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
  font-size: .945rem; color: var(--ink-2); }
.keys-note > span { display: inline-flex; align-items: center; gap: 5px; }
.keys-note .line { flex-basis: 100%; }
.keys-note .tc { display: block; }
.title-panel .panel-actions .wide { grid-column: 1 / -1; }
body.touch .keys-note .kb { display: none; }
body:not(.touch) .keys-note .tc { display: none; }

/* =====================================================================
   Kuis
   ===================================================================== */
.options { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 14px; min-height: 58px; padding: 6px 14px 6px 8px;
  border: var(--line); border-radius: var(--r-btn); background: var(--paper); font: 400 1.111rem/1.3 var(--f-body); color: var(--ink);
  text-align: left; box-shadow: var(--lift-sm); cursor: pointer; transition: transform .06s, box-shadow .06s; }
.opt:active:not(:disabled) { transform: translateY(4px); box-shadow: var(--press); }
@media (hover: hover) { .opt:hover:not(:disabled) { background: var(--paper-2); } }
.opt .key { width: 46px; height: 46px; border-radius: 14px; border: 2.5px solid var(--ink); display: grid; place-items: center;
  font: 700 1.222rem/1 var(--f-head); background: var(--sky); color: var(--ink); }
.opt .key svg.i { font-size: 26px; vertical-align: 0; }
.opt .mark:empty { display: none; }
.opt .mark { font: 700 .945rem/1 var(--f-body); border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 5px 12px; background: var(--paper); white-space: nowrap; }
.opt:disabled { cursor: default; color: var(--ink); }
.opt.right { background: var(--mint); }
.opt.right .key { background: var(--mint-deep); color: var(--white); }
.opt.right .mark { color: var(--mint-deep); }
.opt.wrong { background: var(--rose); animation: shake .4s; }
.opt.wrong .key { background: var(--rose-deep); color: var(--white); }
.opt.wrong .mark { color: var(--rose-deep); }
.opt.dim { background: var(--paper-2); border-color: var(--line-soft); box-shadow: 0 2px 0 rgba(43, 35, 64, .35); color: var(--ink-2); }
.opt.dim .key { background: var(--paper-3); border-color: var(--line-soft); color: var(--ink-2); }
.quiz .feedback:empty { display: none; }
.quiz .feedback { scroll-margin-bottom: 120px; margin-top: 14px; background: var(--lav); border: 2.5px solid var(--ink); border-radius: 20px; padding: 14px 18px;
  display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: start; }
.fb-ic { width: 48px; height: 48px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 26px; }
.fb-ic.ok { background: var(--mint-deep); color: var(--white); }
.fb-ic.no { background: var(--butter); }
.verdict { margin: 0; font: 600 1.167rem/1.2 var(--f-head); }
.quiz .feedback p { margin: 4px 0 8px; font-size: 1.056rem; }

/* =====================================================================
   Dialog pilihan rakaat
   ===================================================================== */
.panel.ask { width: min(640px, 100%); padding: 0 32px 26px; }
.sky-arc { display: block; width: 100%; height: auto; aspect-ratio: 560 / 96; margin: 14px 0 0; }
.arc-l { display: flex; justify-content: space-between; font-size: .945rem; color: var(--ink-2); margin: 2px 18px 4px; }
.ask .when { text-align: center; font-size: 1.056rem; margin: 6px auto 0; max-width: 30em; }
.ask .q { text-align: center; font: 600 1.556rem/1.2 var(--f-head); margin: 12px 0 16px; }
.panel.ask h2#panelTitle:not(.panel-tab) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: 0; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.opt.tile { display: grid; grid-template-columns: none; justify-items: center; align-content: center; gap: 6px; min-height: 120px; padding: 12px 6px;
  border-radius: var(--r-card); box-shadow: var(--lift); text-align: center; }
.tile .n { font: 700 2.778rem/1 var(--f-head); }
.tile .dots { display: flex; gap: 5px; height: 16px; }
.tile .dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--r2m); border: 2px solid var(--ink); }
.tile .w { font: 700 1rem/1 var(--f-body); }
.opt.tile.wrong { background: var(--rose); }
.opt.tile.wrong .dots i { background: var(--rose-deep); }
.ask .feedback { display: flex; justify-content: center; }
.ask .feedback:empty { display: none; }
.nope { display: inline-flex; align-items: center; gap: 8px; margin: 18px auto 0; background: var(--rose); color: var(--rose-deep); border: 2.5px solid var(--ink);
  border-radius: var(--r-pill); padding: 6px 16px 6px 8px; font: 700 1rem/1.25 var(--f-body); }
.nope .ic { width: 28px; height: 28px; border-radius: 50%; background: var(--rose-deep); color: var(--white); display: grid; place-items: center; font-size: 16px; flex: none; }
.ask .panel-actions { justify-content: center; }

/* =====================================================================
   Pengaturan & rujukan
   ===================================================================== */
.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 64px; padding: 10px 16px;
  background: var(--paper-2); border: 2.5px solid var(--ink); border-radius: 18px; cursor: pointer; }
.settings .lt { min-width: 0; font: 600 1.056rem/1.25 var(--f-head); }
.settings .lt small { display: block; font: 400 .945rem/1.3 var(--f-body); color: var(--ink-2); }
.settings input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 60px; height: 34px; margin: 0; cursor: pointer;
  border: var(--line); border-radius: var(--r-pill); background: var(--paper-3); }
.settings input[type=checkbox]::after { content: ''; position: absolute; left: 1px; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--paper) center / 18px no-repeat; border: 2.5px solid var(--ink); box-sizing: border-box; transition: left .15s; }
.settings input[type=checkbox]:checked { background: var(--mint); }
.settings input[type=checkbox]:checked::after { left: 27px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%2317734B' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.settings select { flex: 0 1 auto; min-width: 0; appearance: none; -webkit-appearance: none; min-height: 52px; padding: 0 44px 0 14px; font: 400 1rem/1.2 var(--f-body); color: var(--ink);
  background: var(--paper) right 14px center / 18px no-repeat; border: var(--line); border-radius: 14px; cursor: pointer; max-width: 58%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%232B2340' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.settings .ver { font-size: .945rem; color: var(--ink-2); margin: 2px 4px; }

.panel-body .refs { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 10px; }
.refs li { background: var(--paper-2); border: 2px solid var(--ink); border-radius: 16px; padding: 10px 14px; line-height: 1.45; }
.refs a { display: inline-flex; align-items: center; min-height: 48px; color: var(--r2d); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 700; }
.refs small { display: block; font-size: .945rem; color: var(--ink-2); margin-top: 4px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font: 700 .945rem/1.2 var(--f-body); border: 2px solid var(--ink); border-radius: var(--r-pill);
  padding: 2px 10px 2px 7px; margin: 0 8px 4px 0; vertical-align: middle; }
.refs .badge { display: flex; width: max-content; margin: 0 0 6px; }
.badge.terverifikasi { background: var(--mint); color: var(--mint-deep); }
.badge.perlu-dicek { background: var(--butter); color: var(--r3d); }

/* =====================================================================
   Tanpa WebGL / tanpa JS
   ===================================================================== */
#nogl { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: #A8DBF7; z-index: 20; }
.nogl-card { max-width: 520px; background: var(--paper); border: var(--line); border-radius: var(--r-panel); box-shadow: var(--lift-panel);
  padding: 22px 26px; font-size: 1.056rem; color: var(--ink); text-align: center; }
.nogl-card small { display: block; margin-top: 8px; font-size: .945rem; color: var(--ink-2); }
noscript .nogl-card { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* layar desktop pendek: buku judul tetap muat */
@media (min-width: 521px) {
  #overlay:has(.title-panel) { padding: 20px; }
}
@media (min-width: 521px) and (max-height: 740px) {
  .five { display: none; }
}

/* =====================================================================
   Layar sedang: papan tujuan turun di bawah progres
   ===================================================================== */
@media (min-width: 521px) and (max-width: 1000px) {
  #sign { top: 118px; width: min(560px, calc(100vw - 40px)); padding-top: 0; }
  #sign::before, #sign::after { display: none; }
  /* top diukur dari bawah kompas lewat JS (placeToasts) */
  #toasts { left: auto; right: calc(16px + env(safe-area-inset-right)); transform: none; width: min(360px, 42vw); }
}

/* =====================================================================
   HP (≤ 520px)
   ===================================================================== */
@media (max-width: 520px) {
  /* HUD */
  #progress { left: calc(10px + env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); }
  .hud-cap { display: none; }
  #chips { gap: 6px; padding: 6px; border-radius: 16px; }
  .chip { --ms: 36px; border-width: 2.5px; font-size: 20px; }
  .chip .b-ok, .chip .b-num { width: 20px; height: 20px; border-width: 2px; font-size: 13px; }
  .chip .b-ok { right: -5px; bottom: -5px; } .chip .b-num { left: -6px; top: -6px; }
  .chip.locked { font-size: 1rem; }
  .hud-right { right: calc(10px + env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); }
  .hud-right .icon-btn { width: 52px; height: 52px; }
  /* tombol "ulangi pesan" pindah ke baris atas, di samping tombol menu (papan jadi lebih pendek) */
  .replay { position: fixed; top: max(14px, calc(env(safe-area-inset-top) + 4px)); right: calc(74px + env(safe-area-inset-right)); }
  .menu-lbl { display: none; }
  #exitBtn { display: none !important; }
  #sign { left: 10px; right: 10px; transform: none; width: auto; top: max(74px, calc(env(safe-area-inset-top) + 64px)); padding-top: 0; }
  #sign::before, #sign::after { display: none; }
  #objective { padding: 10px 10px 10px 10px; gap: 10px; }
  #objMed { --ms: 46px; }
  #objTitle { font-size: 1.111rem; }
  #objBody { font-size: .945rem; }
  #compass .tn { display: none; }
  body.hud-compact #toasts { left: 10px; right: 10px; width: auto; transform: none; }
  .hud-compact #objective { padding-top: 12px; }
  #promptBtn { font-size: 1.111rem; }

  /* panel menempel di bawah */
  #overlay { padding: 30px 10px 10px; place-items: safe center; align-items: safe end; }
  .panel { padding: 0 16px 18px; }
  .panel:not(.title-panel):not(.pause):not(.ask) > .panel-actions { margin: 14px -16px -18px; padding: 12px 16px 14px; }
  .panel-top { flex-wrap: wrap; }
  .panel-tab { font-size: 1rem; flex: 0 1 auto; white-space: normal; max-width: calc(100% - 76px); }
  h2.panel-tab { font-size: 1.111rem; }
  .steps { margin-top: 8px; order: 5; flex-basis: 100%; justify-content: flex-end; }
  .panel .speak { width: 48px; height: 48px; margin-top: 10px; }
  .panel h2#panelTitle:not(.panel-tab) { font-size: 1.278rem; margin-top: 10px; }
  .panel-actions { gap: 10px; }
  .panel-actions .btn { flex: 1 1 100%; }
  .panel-actions .btn.primary { order: -1; }
  /* tombol pendamping berbagi satu baris agar bilah tombol tidak menutupi layar */
  .panel:not(.pause):not(.title-panel) .panel-actions .btn:not(.primary) { flex: 1 1 40%; font-size: 17px; padding: 0 8px; gap: 6px; min-height: 52px; }
  .panel-actions .btn.primary { font-size: 1.222rem; padding: 0 16px; }
  .panel.finish .panel-actions { grid-template-columns: 1fr 1fr; gap: 10px; }
  .panel.pause .panel-actions { grid-template-columns: 1fr; }
  .panel-body > p.ar { font-size: 1.45em; }
  .cert { gap: 10px; }
  .cert-name { font-size: 1.556rem; border-radius: 22px; padding: 6px 16px 8px; }
  .cert > svg { width: 56px; height: 56px; }
  .medals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 6px; }
  .medals .med { --ms: 44px; font-size: 26px; }
  .medals b { font-size: .945rem; }
  .tbl td, .tbl th { padding-left: 8px; padding-right: 8px; }
  .rukun-list li { gap: 6px 10px; padding: 8px 10px; }

  /* kuis */
  .opt { grid-template-columns: 40px 1fr; font-size: 1rem; min-height: 56px; padding: 7px 10px 7px 8px; gap: 10px; }
  .opt .key { width: 40px; height: 40px; font-size: 1.056rem; }
  .opt .mark { grid-column: 2; justify-self: start; padding: 3px 10px; }
  .quiz .feedback { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
  .quiz .fb-ic { display: none; }
  .verdict { font-size: 1.111rem; }
  .quiz .feedback p { font-size: 1rem; }

  /* rakaat */
  .panel.ask { padding: 0 16px 18px; }
  .ask .q { font-size: 1.278rem; }
  .choices { gap: 10px; }
  .tile .n { font-size: 2.333rem; }
  .opt.tile { min-height: 108px; }

  /* pengaturan */
  .settings label { padding: 10px 12px; }
  .settings select { max-width: 52%; }

  /* judul (HP) */
  #overlay:has(.title-panel) { align-items: safe start; padding: 10px; }
  .panel.title-panel { width: 100%; }
  .who { padding: 10px 6px; font-size: 1rem; }
  .who > svg { width: 64px; height: 64px; }
  .title-panel .panel-actions { gap: 10px; grid-template-columns: 1fr; }
}
/* HP kecil/pendek: kontrol sentuh sedikit lebih kecil agar dunia 3D tetap terlihat */
@media (max-width: 520px) and (max-height: 700px) {
  #joy { width: 122px; height: 122px; }
  #knob { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
  #actionBtn { width: 90px; height: 90px; }
  #actionBtn > svg.i { font-size: 30px; }
}
@media (max-width: 380px) {
  .hud-compact #objMed { display: none; }
}
@media (max-width: 399px) {
  .panel:not(.pause):not(.title-panel) .panel-actions .btn:not(.primary) > svg.i { display: none; }
  .hud-compact .toast { grid-template-columns: 1fr; }
  .hud-compact .t-ic { display: none; }
  .hud-compact .t-txt::before { display: none; }
  .rukun-list .st { font-size: .945rem; padding: 3px 10px; }
}

/* =====================================================================
   Layar judul: satu lembar bergulir (HP & tablet tegak, lebar ≤ 900px)
   ===================================================================== */
@media (max-width: 520px), (max-width: 900px) and (min-height: 501px) {
  .panel.title-panel { width: min(640px, 100%); }
  .book { display: flex; flex-direction: column; background: var(--peach); border: var(--line); border-radius: var(--r-panel); padding: 0 12px 16px;
    filter: none; box-shadow: 0 6px 0 rgba(43, 35, 64, .9); }
  .page.l { display: contents; }
  .page.l::after, .page.r::before { display: none; }
  .bunting { order: 0; position: relative; top: -3px; left: auto; right: auto; margin: 0 14px; height: 30px; }
  .flag { width: 24px; height: 28px; }
  .book h1 { order: 1; font-size: 2rem; margin: 8px 0 14px 4px; }
  .book h1 span { font-size: 1.278rem; }
  .lead, .five { display: none; }
  .page.r { order: 3; border: var(--line); border-radius: var(--r-card); padding: 16px 14px; }
  .hadith { order: 4; margin-top: 26px; }
  .hadith .ar { font-size: 1.278rem; }
  .field-l, .avatar-pick legend { font-size: 1.111rem; margin-bottom: 8px; }
  #nameInput { height: 56px; }
  .avatar-pick { margin: 16px 0; }
  .avatar-pick .pick { gap: 10px; }
  /* cara main di HP + catatan orang tua tetap tampil (di bawah tombol) */
  .keys-wrap { display: block; margin-top: 12px; padding-top: 0; }
}

/* =====================================================================
   HP mendatar (tinggi ≤ 500px): HUD tipis, kontrol di pojok bawah
   ===================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
  #progress { left: calc(10px + env(safe-area-inset-left)); top: 8px; }
  .hud-cap { display: none; }
  #chips { padding: 5px; gap: 5px; border-radius: 16px; }
  .chip { --ms: 36px; border-width: 2px; font-size: 20px; }
  .chip .b-ok, .chip .b-num { width: 18px; height: 18px; border-width: 2px; font-size: 11px; }
  .chip .b-ok { right: -5px; bottom: -5px; } .chip .b-num { left: -6px; top: -6px; }
  .chip.locked { font-size: 1rem; }
  #sign { top: 8px; left: 50%; transform: translateX(-50%); width: min(46vw, 440px); padding-top: 0; }
  #sign::before, #sign::after { display: none; }
  #objective { padding: 6px 8px 6px 6px; gap: 8px; border-radius: 14px; }
  #objMed { --ms: 40px; }
  #objTitle { font-size: 1rem; }
  #objBody { font-size: .945rem; }
  .seq { margin: 2px 0 0; gap: 4px; }
  .pips > i { width: 22px; height: 22px; font-size: 13px; }
  #compass { margin-top: 6px; padding: 2px 12px 2px 3px; font-size: 1rem; }
  #compass .dial { width: 34px; height: 34px; }
  #arrow { font-size: 24px; }
  #compass .tn { display: none; }
  .hud-right { top: 8px; right: calc(10px + env(safe-area-inset-right)); }
  .hud-right .icon-btn { width: 48px; height: 48px; font-size: 22px; }
  .menu-lbl { display: none; }
  #exitBtn { display: none !important; }
  /* balon di kanan atas (di bawah menu), jauh dari avatar di tengah */
  body.hud-compact #toasts { left: auto; right: calc(10px + env(safe-area-inset-right)); transform: none; top: 66px; width: calc(27vw - 10px); }
  .hud-compact .toast { grid-template-columns: 1fr; }
  .hud-compact .t-ic, .hud-compact .t-txt::before { display: none; }
  #joy { width: 118px; height: 118px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  #knob { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
  #actionBtn { width: 88px; height: 88px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  #actionBtn > svg.i { font-size: 30px; }
  #prompt { bottom: 12px; }
  #help { display: none; }

  /* panel */
  #overlay { padding: 26px 12px 8px; }
  /* menu jeda mendatar: lima medali sebaris, status cukup dari lencana medali */
  .pause .rukun-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pause .rukun-list li { position: relative; flex-direction: column; gap: 4px; padding: 6px 4px; text-align: center; }
  .pause .rukun-list .nm { flex: none; font-size: 1rem; }
  .pause .rukun-list .st { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; border: 0; margin: 0; }
  .panel h2#panelTitle:not(.panel-tab) { margin: 8px 0 8px; font-size: 1.278rem; }

  /* layar judul: buku dua halaman yang ringkas; nama, tokoh dan "Ayo Mulai!" muat di layar pertama */
  #overlay:has(.title-panel) { padding: 8px; align-items: safe start; }
  .book { filter: drop-shadow(0 5px 0 rgba(43, 35, 64, .9)); }
  .page { padding: 12px 16px 12px; }
  .bunting { height: 28px; }
  .flag { width: 22px; height: 26px; }
  .book h1 { font-size: 1.667rem; margin: 20px 0 6px; }
  .book h1 span { font-size: 1.111rem; margin-bottom: 0; }
  .lead, .five, .keys-wrap, .title-panel .parent { display: none; }
  .hadith { padding: 8px 12px 10px; }
  .hadith .ar { font-size: 1.222rem; line-height: 1.6; }
  .hadith .tr { font-size: .945rem; margin: 2px 0 6px; line-height: 1.35; }
  .name-row { margin: 0 0 4px; }
  .field-l, .avatar-pick legend { font-size: 1rem; }
  .name-row .speak { width: 44px; height: 44px; font-size: 20px; }
  #nameInput { height: 48px; }
  .avatar-pick { margin: 8px 0 10px; }
  .avatar-pick legend { margin-bottom: 6px; }
  .who { grid-auto-flow: column; justify-content: center; align-items: center; padding: 5px 10px; gap: 8px; font-size: 1rem; }
  .who > svg { width: 44px; height: 44px; }
  .who .tick { width: 30px; height: 30px; top: -10px; right: -10px; font-size: 16px; }
  .title-panel .panel-actions { gap: 8px; }
  .title-panel .panel-actions .btn { min-height: 48px; font-size: .945rem; padding: 0 8px; gap: 6px; }
  .title-panel .panel-actions .primary { min-height: 54px; font-size: 1.222rem; }
}

/* =====================================================================
   Kurangi gerakan
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; }

/* ---- Layar judul ringkas (v2.2.1): muat satu layar tanpa gulir ---- */
.link-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; min-height: 48px; padding: 0 14px; border: 2.5px solid var(--ink);
  border-radius: 999px; background: var(--paper); color: var(--ink); font: 600 1rem/1.1 var(--f-head); cursor: pointer; box-shadow: 0 3px 0 rgba(43, 35, 64, .25); }
.link-btn svg.i { width: 20px; height: 20px; }
@media (hover: hover) { .link-btn:hover { background: var(--paper-3); } }
.link-btn:focus-visible { outline: 4px dashed var(--r2d); outline-offset: 4px; }
.hadith.plain { margin: 12px 0; }
.hadith.plain::before { display: none; }
@media (min-width: 901px) {
  .book .page.l { display: flex; flex-direction: column; }
  .book .page.l .five { margin-top: 8px; }
  .book .page.l .link-btn { margin-top: auto; align-self: flex-start; }
}
@media (max-width: 520px), (max-width: 900px) and (min-height: 501px) {
  .link-btn { order: 4; align-self: center; margin-top: 14px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .link-btn { margin-top: 8px; min-height: 44px; font-size: .945rem; }
}

/* ---- Rapor orang tua ---- */
.panel h3 { font: 600 1.222rem/1.2 var(--f-head); margin: 4px 0 10px; }
.rapor-wrap { overflow-x: auto; margin: 0 0 6px; }
.rapor { width: 100%; border-collapse: separate; border-spacing: 0; border: 2.5px solid var(--ink); border-radius: 16px; overflow: hidden; font-size: .945rem; background: var(--white); }
.rapor th, .rapor td { padding: 8px 10px; text-align: left; vertical-align: middle; border-bottom: 1.5px solid var(--line-soft); }
.rapor thead th { background: var(--paper-2); font: 600 .9rem/1.2 var(--f-head); }
.rapor tbody tr:last-child th, .rapor tbody tr:last-child td { border-bottom: 0; }
.rapor tbody th { font: 600 1rem/1.1 var(--f-head); white-space: nowrap; }
.rapor tbody th > * { vertical-align: middle; }
.rapor tbody th .med { display: inline-grid; margin-right: 8px; }
.rapor .med { --ms: 34px; font-size: 20px; }
.rapor .st { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--ink-2); }
.rapor .st.ok { color: var(--mint-deep); font-weight: 700; }
.rapor .st svg.i { width: 16px; height: 16px; }

/* Tombol bawah yang menempel (sticky) harus benar-benar di dasar layar: tanpa padding bawah di overlay,
   supaya teks panel tidak terlihat di bawah tombol. Jarak bawah diganti margin panel. */
#overlay { padding-bottom: 0 !important; }
#overlay > .panel { margin-bottom: 16px; }
