/* Kembara Tajwid — gaya UI */
:root {
  --navy: #1f3d6e;
  --navy-2: #2a4f8a;
  --navy-3: #16305a;
  --cream: #fff8e8;
  --cream-2: #f6e8c8;
  --paper: #fffdf7;
  --gold: #f4b63f;
  --gold-2: #ffd34d;
  --gold-dark: #b77d12;
  --green: #2f9a62;
  --green-2: #3ccf7a;
  --red: #e05252;
  --blue: #3aa0ff;
  --ink: #2a2a33;
  --muted: #6c6a73;
  --line: #e8dcc0;
  --shadow: 0 6px 18px rgba(20, 30, 60, 0.18);
  --r: 16px;
  --font: 'Nunito', system-ui, sans-serif;
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --arabic: 'Amiri Quran', 'Amiri', 'Scheherazade New', serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #2c5a3a radial-gradient(ellipse at top, #3f7a52, #1f3d2b);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#app { height: 100%; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, select { font: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; }
[lang='ar'] { font-family: var(--arabic); }
.ar-inline { font-family: var(--arabic); font-size: 1.28em; line-height: 1; unicode-bidi: isolate; color: #1f3d6e; }

/* ───────── Butang ───────── */
.btn {
  border: 0; border-radius: 999px; padding: 10px 18px;
  background: var(--cream-2); color: var(--navy); font-family: var(--display); font-weight: 600; font-size: 15px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15); transition: transform 0.08s, filter 0.15s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15); }
.btn.primary { background: linear-gradient(#ffcf55, #f2ac2c); color: #4a2e00; box-shadow: 0 3px 0 #b77d12; }
.btn.ghost { background: #fff; border: 2px solid var(--line); box-shadow: none; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.big { padding: 14px 24px; font-size: 17px; }
.btn:disabled { opacity: 0.5; }

/* ───────── Skrin ───────── */
.screen { min-height: 100%; display: flex; flex-direction: column; }
.center-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 18px; }
.loading { display: grid; place-items: center; min-height: 100%; color: #fff; }
.loader { text-align: center; font-family: var(--display); }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, 0.25); border-top-color: var(--gold-2); margin: 0 auto 12px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.logo { text-align: center; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); }
.logo-ar { font-family: var(--arabic); font-size: 56px; line-height: 1.7; color: var(--gold-2); margin-bottom: -8px; }
.logo-title { font-family: var(--display); font-size: 40px; font-weight: 700; letter-spacing: 0.5px; }
.logo-sub { font-size: 15px; opacity: 0.9; margin-top: 4px; }

.card { background: var(--paper); border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); padding: 24px; width: min(440px, 100%); }
.card h2 { color: var(--navy); font-size: 22px; margin-bottom: 6px; }
.form label { display: block; font-weight: 700; font-size: 14px; color: var(--navy); margin-top: 14px; }
.form input, .create-opts input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; font-size: 16px; outline: none;
}
.form input:focus, .create-opts input:focus { border-color: var(--gold); }
.form .btn { width: 100%; margin-top: 18px; }
.form-msg { min-height: 0; font-size: 14px; margin-top: 10px; }
.form-msg.bad { color: #b42323; background: #ffe9e9; padding: 10px 12px; border-radius: 10px; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.small { font-size: 12.5px; margin-top: 14px; }
.seller { margin-top: 14px; background: #fff3d6; border-radius: 12px; padding: 10px 12px; font-size: 14px; color: #6a4a00; }

/* Cipta watak */
.create-card { width: min(720px, 100%); }
.create-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; margin-top: 14px; }
.preview-box { background: linear-gradient(#e7f6ff, #f4fbe9); border-radius: 18px; display: grid; place-items: center; }
.char-preview { width: 240px; height: 260px; }
.create-opts label { font-weight: 700; color: var(--navy); font-size: 14px; }
.opt-block { margin-top: 12px; }
.opt-block small { display: block; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 700; color: var(--navy); }
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.sw.on { box-shadow: 0 0 0 3px var(--gold); }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@media (max-width: 640px) {
  .create-grid { grid-template-columns: 1fr; }
  .char-preview { width: 200px; height: 216px; }
}

/* ───────── Peta Dunia ───────── */
.map { min-height: 100%; background: linear-gradient(#bfe6ff 0, #d9f2c7 320px, #a9d98a 100%); }
.map-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--navy); color: #fff; box-shadow: var(--shadow);
}
.map-brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 18px; }
.logo-mini { font-size: 24px; color: var(--gold-2); }
.map-player { display: flex; align-items: center; gap: 8px; background: var(--navy-2); border-radius: 999px; padding: 4px 14px 4px 4px; cursor: pointer; margin-left: auto; }
.map-player b { display: block; font-family: var(--display); font-size: 14px; }
.map-player small { font-size: 12px; opacity: 0.9; }
.map-player .portrait { background: #fff; border-radius: 50%; }
.map-actions { display: flex; gap: 6px; }
.teacher-bar { background: #ffe9a6; color: #5a4000; text-align: center; padding: 8px; font-weight: 700; font-size: 14px; }
.map-main { max-width: 760px; margin: 0 auto; padding: 22px 16px 60px; }
.map-title { text-align: center; color: var(--navy); margin-bottom: 18px; }
.map-title h1 { font-size: 30px; }
.map-title p { margin: 6px 0 0; color: #3a4a5a; }
.cert-btn { display: block; margin: 0 auto 18px; }
.lv-path { display: flex; flex-direction: column; gap: 14px; position: relative; }
.lv-path::before { content: ''; position: absolute; left: 50%; top: 20px; bottom: 20px; border-left: 6px dashed rgba(31, 61, 110, 0.25); transform: translateX(-50%); }
.lv-node {
  position: relative; display: flex; align-items: center; gap: 14px; width: min(440px, 92%); padding: 12px 16px; text-align: left;
  border: 0; border-radius: 20px; background: var(--paper); box-shadow: 0 5px 0 rgba(31, 61, 110, 0.18), var(--shadow);
}
.lv-node:nth-child(odd) { align-self: flex-start; }
.lv-node:nth-child(even) { align-self: flex-end; }
.lv-node.locked { background: #e9e6df; color: #8a8780; box-shadow: none; }
.lv-node.next { outline: 3px solid var(--gold); animation: pulse 1.6s ease-in-out infinite; }
.lv-node.done { background: #f0fbf2; }
@keyframes pulse { 50% { outline-color: rgba(244, 182, 63, 0.3); } }
.lv-ico { position: relative; font-size: 34px; width: 62px; height: 62px; display: grid; place-items: center; background: linear-gradient(#e8f5ff, #d4ecff); border-radius: 18px; flex: none; }
.lv-badge { position: absolute; top: -6px; left: -6px; background: var(--navy); color: #fff; font: 700 12px var(--display); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #fff; }
.lv-info b { display: block; font-family: var(--display); font-size: 17px; color: var(--navy); }
.lv-node.locked .lv-info b { color: #8a8780; }
.lv-info small { display: block; font-size: 13px; color: var(--muted); }
.lv-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.side-meta { font-size: 12px; color: var(--muted); font-weight: 700; }
.stars-row { display: inline-flex; gap: 2px; font-size: 18px; line-height: 1; }
.stars-row .on { color: #f2ac2c; text-shadow: 0 1px 0 #b77d12; }
.stars-row .off { color: #d6d0c2; }

/* ───────── HUD permainan ───────── */
.play { height: 100%; }
.game-screen { position: fixed; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > *, .hud button { pointer-events: auto; }
/* ───────── HUD permainan ─────────
   Tiga saiz: komputer (asal), telefon menegak (≤640px lebar), skrin rendah / telefon melintang (≤500px tinggi).
   Hanya butang utama di skrin; selebihnya dalam Menu ☰. */
.hud { --gap: 12px; --top: max(12px, env(safe-area-inset-top)); --bot: max(14px, env(safe-area-inset-bottom)); --side: max(12px, env(safe-area-inset-left)); }
.hud-tl { position: absolute; top: var(--top); left: var(--side); width: 320px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.hud-tr { position: absolute; top: var(--top); right: max(12px, env(safe-area-inset-right)); width: 196px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; pointer-events: none; }
.hud-tl > *, .hud-tr > * { pointer-events: auto; }
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-row.end { justify-content: flex-end; }
.hud-menu {
  width: 48px; height: 48px; border-radius: 14px; border: 3px solid #f2d7a0; font-size: 22px; color: var(--gold-2); flex: none;
  background: linear-gradient(#8a5a2e, #6a4220); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.player-card { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; border-radius: 16px; padding: 5px 12px 5px 5px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.pc-portrait { width: 40px; height: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.pc-info { flex: 1; min-width: 0; }
.pc-row { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.pc-name { font: 600 14px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-task { font-size: 12px; opacity: 0.85; white-space: nowrap; }
.pc-row2 { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.bar { height: 6px; background: rgba(255, 255, 255, 0.2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: inherit; transition: width 0.4s; }
.hearts { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.12); border-radius: 999px; padding: 2px 8px 2px 6px; font-size: 12px; line-height: 1.2; }
.hearts .hp-ico { color: #ff4d6d; font-size: 13px; }
.hearts b { font: 700 12px var(--display); }
.hearts.low { background: rgba(255,77,109,0.35); }
.hearts.low .hp-ico { animation: badgePulse 0.8s ease-in-out infinite; display: inline-block; }
.darjat { display: flex; align-items: center; gap: 4px; font-size: 11px; white-space: nowrap; }
.darjat .xp { width: 40px; height: 5px; background: rgba(255,255,255,0.2); border-radius: 99px; overflow: hidden; }
.darjat .xp i { display: block; height: 100%; background: #7fffd4; }

/* objektif + senarai tugasan (lipat) */
.quest-panel { background: var(--navy); color: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 260px); max-height: calc(100dvh - 260px); }
.qp-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: var(--navy-2); color: #fff; text-align: left; }
.lv-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--navy); font: 700 14px var(--display); display: grid; place-items: center; }
.qp-obj { flex: 1; min-width: 0; }
.obj-title { font: 600 14px/1.25 var(--display); }
.obj-sub { font-size: 12px; margin-top: 3px; color: var(--gold-2); font-weight: 700; }
.qp-obj .bar { margin-top: 5px; }
.qp-head .chev { flex: none; transition: transform 0.2s; opacity: 0.8; }
.quest-panel.collapsed .chev { transform: rotate(-90deg); }
.quest-panel.collapsed .qp-body { display: none; }
.qp-body { display: flex; flex-direction: column; min-height: 0; }
.qp-lv { padding: 8px 12px 0; }
.qp-lv b { display: block; font: 600 14px var(--display); }
.qp-lv small { display: block; font-size: 12px; opacity: 0.8; }
.qp-lv .pc-task { display: block; margin-top: 2px; color: var(--gold-2); font-weight: 700; }
.step-list { list-style: none; margin: 0; padding: 6px 10px; overflow: auto; counter-reset: s; }
.step-list li { counter-increment: s; position: relative; padding: 7px 8px 7px 36px; font-size: 13px; line-height: 1.3; border-radius: 10px; margin: 2px 0; opacity: 0.75; }
.step-list li::before { content: counter(s); position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); display: grid; place-items: center; font: 700 11px var(--display); }
.step-list li.done { opacity: 0.9; }
.step-list li.done::before { content: '✓'; background: var(--green-2); color: #fff; }
.step-list li.cur { opacity: 1; background: rgba(255, 211, 77, 0.16); outline: 2px solid rgba(255, 211, 77, 0.6); }
.step-list li.cur::before { background: var(--gold-2); color: var(--navy); }
.qp-foot { display: flex; gap: 6px; padding: 6px 10px 10px; }
.qp-foot .btn { flex: 1; }

/* butang ikon kecil (Almari, peta, dll.) */
.hud-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 56px; height: 52px; padding: 0 4px; border-radius: 14px; border: 0; background: linear-gradient(#fffaf0, #f3e3bf); color: var(--navy); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); }
.hud-btn span { font-size: 20px; line-height: 1; }
.hud-btn small { font: 600 11px var(--display); white-space: nowrap; }
.coin-chip { background: var(--navy); color: #fff; font: 600 13px var(--display); padding: 6px 12px; border-radius: 999px; box-shadow: 0 2px 0 rgba(0,0,0,0.2); white-space: nowrap; }
.minimap { background: var(--navy); border-radius: 14px; padding: 5px; box-shadow: var(--shadow); }
.mini-cv { display: block; width: 100%; height: 104px; border-radius: 10px; background: #000; }
.kitab-panel { background: var(--navy); border-radius: 14px; box-shadow: var(--shadow); color: #fff; overflow: hidden; display: flex; flex-direction: column; min-height: 0; max-height: 46vh; }
.kp-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 10px; border: 0; background: var(--navy-2); color: #fff; font: 600 13px var(--display); text-align: left; }
.kp-head .kp-count { margin-left: auto; font-size: 12px; opacity: 0.85; }
.kp-head .chev { transition: transform 0.2s; transform: rotate(-90deg); }
.kitab-panel.open .kp-head .chev { transform: none; }
.kitab-list { display: none; flex-direction: column; gap: 4px; padding: 6px; overflow: auto; }
.kitab-panel.open .kitab-list { display: flex; }
.kitab { display: flex; align-items: center; gap: 6px; border: 0; border-radius: 10px; padding: 7px 8px; background: #fff8e8; color: var(--navy); text-align: left; font-weight: 800; font-size: 12.5px; }
.kitab.locked { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.6); }
.kitab .kt-ico { font-size: 17px; }
.kitab .kt-name { flex: 1; line-height: 1.2; }
.kitab .kt-prog { background: #e3f1ff; border-radius: 99px; padding: 1px 6px; font-size: 11px; }

/* bawah tengah: kepingan ilmu + kurma/zamzam */
.bottom-strip { position: absolute; left: 50%; transform: translateX(-50%); bottom: var(--bot); display: flex; gap: 8px; align-items: center; max-width: min(380px, 34vw); }
.ilmu-bar { flex: 1; min-width: 0; height: 40px; display: flex; align-items: center; gap: 6px; background: rgba(20,40,70,0.85); border-radius: 12px; padding: 0 8px; color: #fff; box-shadow: var(--shadow); }
.ib-head { flex: none; font: 600 14px var(--display); display: flex; align-items: center; gap: 2px; }
.ib-count { font-size: 13px; }
.ilmu-pieces { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 3px 0; }
.ilmu-pieces::-webkit-scrollbar { display: none; }
.ilmu-chip { position: relative; flex: none; height: 30px; border: 2px solid #7fffd4; background: #fffdf4; color: var(--navy); border-radius: 9px; padding: 0 7px; font-weight: 800; font-size: 11.5px; line-height: 26px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ilmu-chip.ar { font-size: 16px; min-width: 30px; padding: 0 6px; }
.ilmu-chip i { font-style: normal; font-size: 10px; color: #2aa88a; margin-left: 3px; font-family: var(--font); }
.ib-empty { font-size: 12px; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hotbar { display: flex; gap: 6px; }
.hot { position: relative; width: 40px; height: 40px; border: 0; border-radius: 12px; background: linear-gradient(#fffaf0, #f3e3bf); font-size: 19px; line-height: 1; display: grid; place-items: center; box-shadow: var(--shadow); color: var(--navy); }
.hot b { position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--navy); color: #fff; font: 700 11px/18px var(--display); text-align: center; }
.hot.empty { opacity: 0.6; }

/* kanan bawah: butang utama */
.actions { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: var(--bot); display: flex; align-items: flex-end; gap: 12px; }
.combat-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.combat-row { display: flex; gap: 8px; }
.btn-attack { width: 92px; height: 92px; border-radius: 50%; border: 5px solid #ffd0d0; color: #fff; font: 700 13px var(--display); letter-spacing: 0.5px;
  background: radial-gradient(circle at 40% 30%, #ff7a6b, #b8262a); box-shadow: 0 5px 0 rgba(0,0,0,0.3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; touch-action: none; }
.btn-attack .w-ico { font-size: 32px; line-height: 1; }
.btn-attack:active { transform: scale(0.94); }
.btn-interact { width: 104px; height: 104px; border-radius: 50%; border: 5px solid #f2d7a0; color: #fff; font: 700 13px var(--display); letter-spacing: 0.5px;
  background: radial-gradient(circle at 40% 30%, #8a6a4a, #4a3420); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; opacity: 0.8; transition: transform 0.1s; }
.btn-interact .hand { font-size: 34px; line-height: 1; }
.btn-interact.ready { opacity: 1; background: radial-gradient(circle at 40% 30%, #ffd86a, #e09a1a); color: #4a2e00; animation: ready 1s ease-in-out infinite; }
.btn-interact:active { transform: scale(0.95); }
@keyframes ready { 50% { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(255, 211, 77, 0.35); } }
.btn-weapon, .btn-skill, .hud-btn.mini-round { position: relative; overflow: hidden; width: 50px; height: 50px; padding: 0; border-radius: 50%; border: 3px solid #f2d7a0; background: linear-gradient(#fffaf0, #f3e3bf);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-shadow: 0 3px 0 rgba(0,0,0,0.2); color: var(--navy); }
.btn-weapon span, .btn-skill span, .hud-btn.mini-round span { font-size: 19px; line-height: 1; }
.btn-weapon small, .btn-skill small, .hud-btn.mini-round small { font: 700 10px var(--display); }
.btn-skill { background: linear-gradient(#fff3c4, #f2c94c); }
.btn-skill .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(20,30,60,0.45); }
.btn-skill.cooling { filter: grayscale(0.6); }

/* joystick terapung */
.joy-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 48%; touch-action: none; }
.joystick { position: absolute; left: 24px; bottom: var(--bot); width: 128px; height: 128px; border-radius: 50%; opacity: 0.75; transition: opacity 0.15s; touch-action: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.15)); border: 3px solid rgba(255, 255, 255, 0.6); }
.joystick.active { opacity: 1; }
.knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff, #cfe3ff); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25); }

/* Menu ☰ */
.menu-wallet { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.menu-wallet span { background: var(--cream-2); color: var(--navy); font: 600 14px var(--display); padding: 6px 12px; border-radius: 999px; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 6px; border-radius: 16px; border: 0; background: linear-gradient(#fffaf0, #f3e3bf); color: var(--navy); box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.menu-tile span { font-size: 26px; line-height: 1; }
.menu-tile b { font: 600 13px var(--display); text-align: center; }
.menu-tile.primary { background: linear-gradient(#ffe48a, #f4b63f); }
.menu-tile.warn { background: linear-gradient(#e8f0fb, #cddcf2); }

/* telefon & tablet kecil */
@media (max-width: 900px) {
  .hud-tl { width: 280px; }
  .hud-tr { width: 160px; }
  .mini-cv { height: 88px; }
  .bottom-strip { max-width: 36vw; }
}
/* telefon menegak */
@media (max-width: 640px) {
  .hud { --top: max(8px, env(safe-area-inset-top)); --bot: max(12px, env(safe-area-inset-bottom)); --side: 8px; }
  .hud-tl { width: calc(100% - 136px); gap: 6px; }
  .hud-tr { right: 8px; width: 116px; gap: 6px; }
  .hud-menu { width: 42px; height: 42px; font-size: 19px; border-radius: 12px; }
  .player-card { padding: 4px 8px 4px 4px; gap: 7px; border-radius: 14px; }
  .pc-portrait { width: 32px; height: 32px; }
  .pc-name { font-size: 13px; }
  .pc-task, .darjat .xp { display: none; }
  .hearts { padding: 1px 7px 1px 5px; } .hearts b { font-size: 11px; }
  .darjat { font-size: 10.5px; }
  .qp-head { padding: 7px 9px; gap: 8px; }
  .lv-num { width: 24px; height: 24px; font-size: 12px; }
  .obj-title { font-size: 12.5px; }
  .obj-sub { font-size: 11px; }
  .quest-panel { max-height: 52vh; }
  .coin-chip { display: none; }
  .hud-btn { width: 44px; height: 44px; border-radius: 12px; }
  .hud-btn small { display: none; }
  .mini-cv { height: 66px; }
  .kp-head { font-size: 12px; padding: 7px 8px; }
  .kitab-panel { max-height: 40vh; }
  .kitab { font-size: 12px; }
  /* kepingan & item: baris kecil di atas joystick */
  .bottom-strip { left: 8px; right: auto; transform: none; max-width: calc(100% - 16px); bottom: calc(var(--bot) + 140px); }
  .ilmu-bar { flex: none; height: 36px; padding: 0 9px; border-radius: 11px; }
  .ilmu-pieces { display: none; }
  .ilmu-bar { cursor: pointer; }
  .hot { width: 36px; height: 36px; font-size: 16px; border-radius: 11px; }
  .actions { right: 8px; gap: 8px; }
  .btn-attack { width: 78px; height: 78px; font-size: 11.5px; border-width: 4px; }
  .btn-attack .w-ico { font-size: 26px; }
  .btn-interact { width: 88px; height: 88px; font-size: 11.5px; border-width: 4px; }
  .btn-interact .hand { font-size: 28px; }
  .btn-weapon, .btn-skill, .hud-btn.mini-round { width: 44px; height: 44px; }
  .btn-weapon small, .btn-skill small, .hud-btn.mini-round small { display: none; }
  .joy-zone { width: 50%; height: 40%; }
  .joystick { width: 112px; height: 112px; left: 14px; }
  .knob { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .menu-tile { min-height: 76px; }
}
/* skrin rendah: telefon melintang */
@media (max-height: 500px) {
  .hud { --top: max(6px, env(safe-area-inset-top)); --bot: max(8px, env(safe-area-inset-bottom)); --side: max(8px, env(safe-area-inset-left)); }
  .hud-tl { width: 250px; gap: 5px; }
  .hud-tr { width: 132px; gap: 5px; }
  .hud-menu { width: 38px; height: 38px; font-size: 17px; border-radius: 11px; border-width: 2px; }
  .player-card { padding: 3px 8px 3px 3px; gap: 6px; border-radius: 12px; }
  .pc-portrait { width: 30px; height: 30px; }
  .pc-name { font-size: 12.5px; }
  .pc-task, .darjat .xp { display: none; }
  .hearts { font-size: 10.5px; }
  .darjat { font-size: 10.5px; }
  .bar { height: 5px; margin-top: 3px; }
  .qp-head { padding: 5px 8px; gap: 7px; }
  .lv-num { width: 22px; height: 22px; font-size: 11.5px; }
  .obj-title { font-size: 12px; }
  .obj-sub { font-size: 10.5px; margin-top: 2px; }
  .quest-panel { max-height: calc(100vh - 70px); max-height: calc(100dvh - 70px); border-radius: 12px; }
  .coin-chip { font-size: 11.5px; padding: 4px 9px; }
  .hud-btn { width: 40px; height: 40px; border-radius: 11px; }
  .hud-btn span { font-size: 17px; }
  .hud-btn small { display: none; }
  .mini-cv { height: 62px; }
  .minimap { padding: 3px; border-radius: 11px; }
  .kp-head { font-size: 11.5px; padding: 5px 8px; }
  .kitab-panel { max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); border-radius: 11px; }
  .kitab { font-size: 11.5px; padding: 5px 7px; }
  .bottom-strip { bottom: var(--bot); max-width: min(330px, 34vw); }
  .ilmu-bar { height: 34px; padding: 0 7px; border-radius: 11px; }
  .ilmu-chip { height: 26px; font-size: 11px; line-height: 22px; padding: 0 6px; }
  .ilmu-chip.ar { font-size: 14px; }
  .ib-empty { font-size: 11px; }
  .hot { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
  .hot b { min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; }
  .actions { gap: 8px; }
  .combat-col { gap: 6px; }
  .combat-row { gap: 6px; }
  .btn-attack { width: 66px; height: 66px; font-size: 10.5px; border-width: 3px; gap: 1px; }
  .btn-attack .w-ico { font-size: 22px; }
  .btn-interact { width: 74px; height: 74px; font-size: 10.5px; border-width: 3px; gap: 1px; }
  .btn-interact .hand { font-size: 24px; }
  .btn-weapon, .btn-skill, .hud-btn.mini-round { width: 38px; height: 38px; border-width: 2px; }
  .btn-weapon span, .btn-skill span, .hud-btn.mini-round span { font-size: 16px; }
  .btn-weapon small, .btn-skill small, .hud-btn.mini-round small { display: none; }
  .joy-zone { height: 60%; width: 40%; }
  .joystick { width: 96px; height: 96px; left: 14px; }
  .knob { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
  .menu-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .menu-tile { min-height: 64px; padding: 6px 4px; gap: 4px; }
  .menu-tile span { font-size: 21px; }
  .menu-tile b { font-size: 11.5px; }
  .menu-wallet { margin-bottom: 8px; }
}

@media (max-width: 640px) { .hikmah-banner { top: calc(max(8px, env(safe-area-inset-top)) + 110px); } }

/* Peta dunia: butang kepala */
.map-actions .hud-btn { width: 56px; height: 50px; }
@media (max-width: 640px) {
  .map-actions .hud-btn { width: 44px; height: 44px; }
  .map-brand b { display: none; }
}

/* ───────── Modal ───────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 25, 45, 0.55); display: grid; place-items: center; padding: 16px;
  opacity: 0; transition: opacity 0.2s;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  width: min(520px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--paper); border-radius: 22px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); overflow: hidden;
  transform: translateY(14px) scale(0.98); transition: transform 0.2s;
}
.modal.wide { width: min(760px, 100%); }
.modal-backdrop.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--navy); color: #fff; }
.modal-head h2 { font-size: 19px; flex: 1; }
.modal-ico { font-size: 22px; }
.modal-x { border: 0; background: rgba(255, 255, 255, 0.15); color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 15px; }
.modal-body { padding: 16px; overflow: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; flex-wrap: wrap; }
.confirm-text { margin: 0; font-size: 15px; line-height: 1.5; }
.sub-h { font-size: 16px; color: var(--navy); margin: 14px 0 8px; }
.sub-h:first-child { margin-top: 0; }
.empty { color: var(--muted); }

/* Dialog NPC */
.dialog-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); background: linear-gradient(transparent 50%, rgba(10, 20, 40, 0.35)); opacity: 0; transition: opacity 0.2s; }
.dialog-wrap.show { opacity: 1; }
.dialog {
  width: min(720px, 100%); display: flex; gap: 14px; background: var(--cream); border: 4px solid #f2d7a0; border-radius: 22px; padding: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.dlg-portrait { flex: none; width: 84px; height: 84px; border-radius: 18px; background: linear-gradient(#dff0ff, #f4fbe9); display: grid; place-items: center; overflow: hidden; }
.dlg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dlg-name { display: inline-block; align-self: flex-start; background: var(--navy); color: #fff; font: 600 13px var(--display); padding: 3px 12px; border-radius: 999px; }
.dlg-text { font-size: 16px; line-height: 1.5; margin: 8px 0; min-height: 48px; color: #3a3020; }
.dlg-actions { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.dlg-choices { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.dlg-next { margin-left: auto; border: 0; background: var(--navy); color: #fff; font: 600 13px var(--display); padding: 8px 14px; border-radius: 999px; }
@media (max-width: 640px) {
  .dlg-portrait { width: 60px; height: 60px; }
  .dlg-portrait .portrait { width: 56px !important; height: 56px !important; }
  .dlg-text { font-size: 15px; }
}

/* Toast */
.toasts { position: fixed; top: calc(max(12px, env(safe-area-inset-top)) + 96px); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, 92vw); }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(-10px); transition: 0.3s; text-align: center; }
.toast.show { opacity: 1; transform: none; }
.toast-gold { background: linear-gradient(#ffd86a, #f2ac2c); color: #4a2e00; }
.toast-bad { background: #b83a3a; }

/* ───────── Kad Ilmu ───────── */
.lesson-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lesson-ar { font-size: 30px; color: var(--navy); line-height: 1.6; }
.harakat { background: #e8f3ff; color: var(--navy); font-weight: 800; font-size: 13px; padding: 6px 12px; border-radius: 999px; }
.lesson-short { background: linear-gradient(#fff3c9, #ffe7a3); border-radius: 14px; padding: 12px 14px; font-weight: 800; color: #5a3d00; margin: 8px 0 10px; font-size: 15.5px; }
.lesson-body { margin: 0; padding-left: 20px; line-height: 1.55; font-size: 15px; }
.lesson-body li { margin: 4px 0; }
.letters { background: #f2f7ff; border-radius: 14px; padding: 10px 12px; margin-top: 12px; }
.letters-label { font-weight: 800; color: var(--navy); font-size: 13px; }
.letters-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.letter { font-family: var(--arabic); font-size: 24px; line-height: 1.9; min-width: 44px; height: 52px; display: grid; place-items: center; background: #fff; border-radius: 10px; box-shadow: 0 2px 0 #d6e2f5; color: var(--navy); padding: 0 6px; }
.mnemonic { margin-top: 8px; font-size: 14px; }
.mnemonic b { font-size: 22px; color: var(--green); }
.symbols { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }
.symbol { display: flex; align-items: center; gap: 10px; background: #f2f7ff; border-radius: 12px; padding: 8px 10px; }
.symbol .sym { font-family: var(--arabic); font-size: 26px; line-height: 1.9; color: #b42323; min-width: 54px; text-align: center; }
.symbol b { display: block; font-size: 14px; }
.symbol small { color: var(--muted); }
.tip { background: #eafaf0; border-radius: 12px; padding: 10px 12px; margin-top: 12px; color: #1f6a3f; font-weight: 700; font-size: 14px; }
.ex-title { color: var(--navy); font-size: 17px; margin-top: 18px; }
.ex-sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 10px; }
.ex-list { display: grid; gap: 10px; }
.ex-card { border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; background: #fff; }
.ayah { font-family: var(--arabic); font-size: 30px; line-height: 2.1; text-align: right; color: #1f2430; word-spacing: 2px; }
.ayah-big { font-size: 38px; }
.ayah .w { border-radius: 8px; padding: 0 3px; transition: background 0.15s; }
.ayah .w.hl { background: #fff0b8; color: #b42323; box-shadow: inset 0 -3px 0 #f2ac2c; }
.ayah .w.tap { cursor: pointer; background: #f3f6fb; margin: 0 1px; }
.ayah .w.tap:hover { background: #e5edfa; }
.ayah .w.found { background: #c9f2db !important; color: #1f6a3f; }
.ayah .w.nope { background: #ffd6d6 !important; animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.ayah-no { color: #b77d12; font-size: 0.8em; margin-right: 4px; }
.ex-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.ex-ref { font-weight: 800; color: var(--navy); font-size: 13px; }
.ex-tr { font-style: italic; }
.ex-note { font-size: 14px; margin-top: 6px; color: #3a3a44; }
.ex-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.ex-ms { margin-top: 8px; font-size: 13.5px; color: #4a4a55; }
.ex-ms summary { cursor: pointer; color: var(--navy); font-weight: 700; }
.ex-ms p { margin: 6px 0 0; line-height: 1.5; }
.btn-play {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 8px 14px; font: 600 14px var(--display);
  background: var(--navy); color: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.btn-play.mode-ayah { background: #e8f0fb; color: var(--navy); }
.btn-play.rec { background: #fdeef3; color: #a3264f; }
.btn-play.playing { background: var(--green); color: #fff; animation: playing 0.8s ease-in-out infinite; }
.btn-play.playing .ico { font-size: 0; }
.btn-play.playing .ico::before { content: '■'; font-size: 12px; }
@keyframes playing { 50% { box-shadow: 0 0 0 6px rgba(47, 154, 98, 0.25); } }
.lesson-modal .modal-foot .btn { width: 100%; }

/* ───────── Kuiz & mini-game ───────── */
.q-progress { display: flex; align-items: center; gap: 10px; font: 600 13px var(--display); color: var(--navy); margin-bottom: 10px; }
.q-progress .bar { flex: 1; background: #ece2c9; margin: 0; height: 9px; }
.q-score { color: var(--green); }
.q-prompt { font: 600 17px var(--display); color: var(--navy); margin: 4px 0 10px; line-height: 1.4; }
.q-ex { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 8px 12px; margin-bottom: 12px; }
.q-ex.hidden-text .ayah { filter: blur(9px); user-select: none; }
.q-ex-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 14px;
  padding: 11px 12px; font-size: 15px; font-weight: 700; color: var(--ink); transition: background 0.15s, border-color 0.15s;
}
.opt:not(.correct):not(.wrong):not(.dim):not(:disabled):hover { border-color: var(--gold); background: #fffaf0; }
.opt-letter { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font: 700 13px var(--display); }
.opt.ar .opt-text { font-family: var(--arabic); font-size: 28px; line-height: 1.9; }
.opt.correct { background: #e3f8ec; border-color: var(--green-2); }
.opt.correct .opt-letter { background: var(--green); }
.opt.wrong { background: #ffe8e8; border-color: #f08a8a; }
.opt.wrong .opt-letter { background: var(--red); }
.opt.dim { opacity: 0.55; }
.hint { margin-top: 10px; }
.q-explain { display: none; margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 14.5px; line-height: 1.5; }
.q-explain.show { display: block; }
.q-explain.ok { background: #e3f8ec; color: #1f5a37; }
.q-explain.no { background: #fff1e0; color: #6a3a00; }
.q-result { text-align: center; padding: 14px 6px; }
.q-result-ico { font-size: 54px; }
.q-result h3 { color: var(--navy); font-size: 22px; margin: 6px 0; }
.q-result-score { font-weight: 800; font-size: 16px; margin-bottom: 8px; }
.q-result .stars-row { font-size: 38px; }
.sort-card { display: grid; place-items: center; min-height: 120px; background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 10px; margin-bottom: 12px; }
.sort-card > div { width: 100%; }
.big-letter { font-family: var(--arabic); font-size: 76px; line-height: 1.7; color: var(--navy); text-align: center; }
.sort-buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.sort-buckets.grid { grid-template-columns: repeat(2, 1fr); }
.bucket { justify-content: center; text-align: center; min-height: 54px; }
.find-left { font-weight: 800; color: var(--navy); font-size: 13px; }
.practice { border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.rec-btn { background: #fdeef3; color: #a3264f; }
.rec-btn.recording { background: var(--red); color: #fff; animation: playing 0.8s infinite; }
.meter { height: 6px; background: #f0e8d6; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; background: var(--red); transition: width 0.08s; }
.rec-status { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.my-audio { width: 100%; margin-top: 6px; }
.fact p { font-size: 16px; line-height: 1.55; margin: 0 0 8px; }

/* Panel */
.settings .set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row b { display: block; }
.set-row small { color: var(--muted); }
.set-row input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--green); }
.set-row select { padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); }
.set-account { margin-top: 12px; font-size: 14px; }
.set-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.credit { font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.5; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: #f2f7ff; border-radius: 14px; padding: 10px; text-align: center; }
.stat b { display: block; font: 700 22px var(--display); color: var(--navy); }
.stat small { font-size: 12px; color: var(--muted); }
.ach-grid, .inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach, .inv { background: #f6f3ec; border-radius: 14px; padding: 10px; text-align: center; opacity: 0.6; }
.ach.got, .inv { opacity: 1; background: #fff6dc; }
.inv.key { background: #eafaf0; }
.ach-ico, .inv-ico { font-size: 30px; }
.ach b, .inv b { display: block; font-size: 13.5px; color: var(--navy); margin-top: 2px; }
.ach small, .inv small { font-size: 12px; color: var(--muted); }
.key-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #eafaf0; color: #1f5a37; border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 700; }
.step-list.full li { opacity: 1; color: var(--ink); background: #f6f3ec; padding: 9px 10px 9px 40px; }
.step-list.full li::before { background: #ddd5c2; color: var(--navy); }
.step-list.full li.cur { background: #fff3c9; outline-color: var(--gold); }
.step-list.full li.done::before { background: var(--green); color: #fff; }
.step-list.full { padding: 0; }
.side-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #f2f7ff; margin-bottom: 8px; }
.side-card b { display: block; color: var(--navy); }
.side-card small { color: var(--muted); }
.side-card.done { background: #eafaf0; }
.side-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 12px; font-weight: 800; background: #fff; border-radius: 999px; padding: 4px 10px; color: var(--navy); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.help-grid > div { background: #f2f7ff; border-radius: 14px; padding: 10px 12px; }
.help-grid p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }
.menu-list { display: grid; gap: 10px; }
.notes-level { margin-bottom: 12px; }
.notes-level.locked { opacity: 0.6; }
.notes-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--navy); }
.notes-head .lv-num { background: var(--navy); color: #fff; width: 26px; height: 26px; font-size: 13px; }
.notes-head small { margin-left: auto; color: var(--muted); font-weight: 700; }
.notes-rules { display: flex; flex-wrap: wrap; gap: 6px; }
.note-rule { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-weight: 700; color: var(--navy); font-size: 13.5px; }
.note-rule.locked { color: #9a968c; }
.complete { text-align: center; }
.big-ico { font-size: 64px; }
.complete h3 { color: var(--navy); font-size: 18px; line-height: 1.4; margin: 6px 0 10px; }
.complete .stars-row { font-size: 46px; }
.rewards { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.rewards span { background: #fff3c9; border-radius: 999px; padding: 6px 12px; font-weight: 800; color: #5a3d00; }
.portrait { display: block; }

/* Sijil */
.cert { background: #fffdf5; padding: 10px; }
.cert-inner { border: 6px double #c9a24a; border-radius: 12px; padding: 26px 20px; text-align: center; background: radial-gradient(circle at top, #fff8e1, #fffdf5 70%); }
.cert-top { font-size: 24px; color: #2f6f4f; }
.cert h1 { font-size: 32px; color: var(--navy); margin: 8px 0; }
.cert-name { font: 700 34px var(--display); color: #b77d12; margin: 6px 0; border-bottom: 2px solid #e6cf8f; display: inline-block; padding: 0 20px 4px; }
.cert p { line-height: 1.6; }
.cert-stats { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-weight: 800; color: var(--navy); }
.cert-date { margin-top: 14px; font-weight: 700; }
.cert-dua { font-size: 26px; color: #2f6f4f; margin-top: 14px; }
@media print {
  body * { visibility: hidden; }
  #cert, #cert * { visibility: visible; }
  #cert { position: fixed; inset: 0; }
}

/* ───────── Kad Ilmu: dek slaid ───────── */
.deck-modal { --g1: #2a4f8a; --g2: #5aa0e6; --acc: #ffd34d; }
.deck-modal.fam-pengenalan { --g1: #1f6a4a; --g2: #59c08a; }
.deck-modal.fam-alif_lam { --g1: #22285e; --g2: #e7a83a; }
.deck-modal.fam-ghunnah, .deck-modal.fam-mim_mati { --g1: #8a5a00; --g2: #f2b632; --acc: #fff3c4; }
.deck-modal.fam-nun_mati { --g1: #0f5f63; --g2: #36b3a8; }
.deck-modal.fam-qalqalah { --g1: #9a3b12; --g2: #f08a3c; --acc: #fff0c8; }
.deck-modal.fam-lam_jalalah, .deck-modal.fam-ra { --g1: #4b2a7a; --g2: #a274d8; }
.deck-modal.fam-mad { --g1: #0f3f7a; --g2: #3fa3e0; }
.deck-modal.fam-waqaf { --g1: #7a1f2f; --g2: #e0566b; }
.deck-modal.fam-hamzah_wasal { --g1: #2a6a2f; --g2: #7cc96a; }
.deck-modal.fam-idgham_jenis { --g1: #7a2a5a; --g2: #e070a8; }
.deck-modal .modal { width: min(820px, 100%); height: min(760px, calc(100dvh - 32px)); }
.deck-modal .modal-head { background: var(--g1); }
.deck-modal .modal-body { padding: 0; overflow: hidden; flex: 1; display: flex; }
.deck-track { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.deck-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at 20% 0%, rgba(255,255,255,0.25), transparent 45%), linear-gradient(160deg, var(--g1), var(--g2)); color: #fff; }
.slide-in { min-height: 100%; padding: 26px 22px 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.slide-example .slide-in, .slide-notes .slide-in, .slide-rule .slide-in { justify-content: flex-start; }
.rule-sec { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.rule-sec + .rule-sec { margin-top: 14px; }
.slide-cover .parts { margin-top: 6px; }
.slide-final .vid-frame { margin-top: 6px; }
.sl-h { font-size: 22px; text-shadow: 0 2px 0 rgba(0,0,0,0.2); }
.sl-foot { font-size: 15px; opacity: 0.95; max-width: 520px; }
.pop { opacity: 0; transform: translateY(18px) scale(0.92); }
.slide.active .pop { animation: popin 0.55s cubic-bezier(.2,1.4,.4,1) forwards; animation-delay: calc(var(--d, 0) * 110ms); }
@keyframes popin { to { opacity: 1; transform: none; } }
.cv-icon { font-size: 92px; line-height: 1; filter: drop-shadow(0 8px 12px rgba(0,0,0,0.25)); }
.slide.active .cv-icon { animation: popin 0.6s cubic-bezier(.2,1.4,.4,1) forwards, floaty 3s ease-in-out 0.7s infinite; }
@keyframes floaty { 50% { transform: translateY(-10px) rotate(-3deg); } }
.cv-ar { font-family: var(--arabic); font-size: 48px; line-height: 1.7; color: var(--acc); text-shadow: 0 3px 0 rgba(0,0,0,0.25); }
.cv-title { font: 700 30px var(--display); text-shadow: 0 3px 0 rgba(0,0,0,0.2); }
.cv-family { background: rgba(255,255,255,0.2); padding: 5px 14px; border-radius: 999px; font-weight: 800; font-size: 13px; }
.bubble { position: relative; background: #fff; color: #2a2a33; border-radius: 20px; padding: 14px 18px; font-weight: 800; font-size: 17px; max-width: 520px; box-shadow: 0 8px 20px rgba(0,0,0,0.2); margin-top: 6px; }
.bubble::before { content: ''; position: absolute; top: -10px; left: 50%; margin-left: -10px; border: 10px solid transparent; border-top: 0; border-bottom-color: #fff; }
.bubble .ar-inline { color: #b42323; }
.swipe-hint { display: flex; gap: 8px; align-items: center; font-weight: 800; opacity: 0.85; margin-top: 10px; }
.swipe-arrow { display: inline-block; animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(8px); } }
.parts { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; }
.part { background: #fff; color: #2a2a33; border-radius: 22px; padding: 16px 18px; min-width: 150px; box-shadow: 0 8px 0 rgba(0,0,0,0.15); display: flex; flex-direction: column; gap: 4px; }
.part-ic { font-size: 44px; }
.part b { font: 700 22px var(--display); color: var(--g1); }
.part span { font-weight: 800; color: #555; }
.plus, .f-op { font: 700 34px var(--display); color: var(--acc); }
.formula { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; }
.f-tile { background: rgba(255,255,255,0.95); color: var(--g1); border-radius: 18px; padding: 14px 16px; min-width: 110px; font-weight: 800; font-size: 17px; box-shadow: 0 6px 0 rgba(0,0,0,0.15); }
.f-tile .ar-inline { font-size: 1.8em; color: #b42323; line-height: 1.5; }
.f-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.f-lbl { display: block; font: 800 12px var(--body, Nunito, sans-serif); color: #6b5a3a; background: #fff5dc; border-radius: 8px; padding: 3px 8px; max-width: 190px; line-height: 1.3; }
.bl span { display: block; line-height: 1.55; }
.bl small { display: block; margin-top: 2px; font: 800 11px Nunito, sans-serif; color: #6b5a3a; line-height: 1.1; text-align: center; }
.term-box { background: rgba(255,255,255,0.92); color: #2a2a33; border-radius: 16px; padding: 10px 14px; max-width: 640px; text-align: left; font-size: 14px; line-height: 1.5; box-shadow: 0 5px 0 rgba(0,0,0,0.12); }
.term-box p { margin: 4px 0; }
.term-box .ar-inline { font-size: 1.55em; color: #b42323; line-height: 1.6; }
.term-box b { color: var(--g1); }
.f-out { background: var(--acc); color: #3a2a00; border-radius: 22px; padding: 14px 18px; min-width: 170px; box-shadow: 0 6px 0 rgba(0,0,0,0.2); }
.f-out-ic { font-size: 40px; }
.f-out b { font: 700 18px var(--display); }
.f-out .ar-inline { color: #3a2a00; }
.big-letters { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 640px; }
.bl { font-family: var(--arabic); font-size: 40px; width: 76px; height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: #fff; color: var(--g1); border-radius: 18px; box-shadow: 0 6px 0 rgba(0,0,0,0.18); line-height: 1; }
.bl.pop { height: 104px; justify-content: space-between; padding: 4px 0 8px; } /* ruang untuk nama huruf */
.mn-banner { background: var(--acc); color: #3a2a00; border-radius: 18px; padding: 10px 20px; display: flex; flex-direction: column; }
.mn-banner small { font-weight: 800; }
.mn-banner b { font-family: var(--arabic); font-size: 34px; line-height: 1.6; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; width: 100%; max-width: 680px; }
.tile { background: #fff; color: #2a2a33; border-radius: 20px; padding: 16px 14px; box-shadow: 0 6px 0 rgba(0,0,0,0.15); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tile-ic { font-size: 40px; }
.tile-sym { font-family: var(--arabic); font-size: 40px; color: #b42323; line-height: 1.4; }
.tile b { font: 700 16px var(--display); color: var(--g1); }
.tile span { font-size: 14px; color: #555; font-weight: 700; }
.step-cards { display: grid; gap: 10px; width: 100%; max-width: 640px; text-align: left; }
.step-card { display: flex; gap: 12px; align-items: flex-start; background: #fff; color: #2a2a33; border-radius: 16px; padding: 12px 14px; box-shadow: 0 4px 0 rgba(0,0,0,0.12); }
.step-card p { margin: 0; font-size: 15.5px; line-height: 1.5; font-weight: 600; }
.step-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--g1); color: #fff; display: grid; place-items: center; font: 700 14px var(--display); }
.slide .tip { max-width: 640px; text-align: left; }
.hmeter { background: #fff; color: #2a2a33; border-radius: 22px; padding: 18px; width: 100%; max-width: 560px; display: grid; gap: 12px; justify-items: center; }
.hm-row { display: flex; align-items: center; gap: 10px; }
.hm-n { font: 700 26px var(--display); color: var(--g1); width: 28px; }
.hm-beats { display: flex; gap: 6px; }
.hm-beats .b { width: 30px; height: 30px; border-radius: 50%; background: #e8eef6; border: 3px solid var(--g2); transition: background 0.15s, transform 0.15s; }
.hm-beats .b.off { opacity: 0.18; border-style: dashed; }
.hm-beats .b.lit { background: var(--g2); transform: scale(1.15); }
.slide-example .ex-card { width: 100%; max-width: 680px; text-align: left; color: #2a2a33; box-shadow: 0 8px 0 rgba(0,0,0,0.15); border: 0; }
.slide-example .ayah { font-size: 36px; }
.slide-example .ex-sub { color: rgba(255,255,255,0.9); margin: 0; }
.slide .ex-sub { color: inherit; }
.deck-modal .modal-foot { justify-content: space-between; align-items: center; gap: 8px; flex-wrap: nowrap; }
.deck-nav { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 24px; color: var(--navy); }
.deck-nav:disabled { opacity: 0.35; }
.deck-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: 1; }
.deck-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; background: #d8d2c2; }
.deck-dots button.on { background: var(--g1); width: 22px; border-radius: 99px; }
.deck-count { font: 600 13px var(--display); color: var(--muted); white-space: nowrap; }
.deck-next { white-space: nowrap; }
@media (max-width: 640px) {
  .deck-modal { padding: 0; }
  .deck-modal .modal { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .cv-icon { font-size: 76px; } .cv-ar { font-size: 40px; } .cv-title { font-size: 25px; }
  .part { min-width: 120px; padding: 12px; } .part-ic { font-size: 36px; }
  .bl, .bl.pop { width: 64px; height: 92px; font-size: 32px; }
  .deck-count { display: none; }
  .slide-example .ayah { font-size: 30px; }
}

/* ───────── Pertarungan ───────── */
.battle-modal .modal-head { background: linear-gradient(90deg, #5a1030, #8a2050); }
.arena { display: flex; align-items: center; gap: 14px; background: radial-gradient(circle at 30% 60%, #3b1f5e, #1a1030); border-radius: 18px; padding: 10px 14px; color: #fff; }
.foe-box { flex: none; }
.foe-cv { display: block; }
.foe-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.foe-kind { align-self: flex-start; background: rgba(255,255,255,0.16); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 800; }
.foe-name { font: 700 22px var(--display); }
.foe-hp { height: 12px; background: rgba(255,255,255,0.2); border-radius: 99px; overflow: hidden; }
.foe-hp i { display: block; height: 100%; background: linear-gradient(90deg, #ff6b6b, #e5483b); transition: width 0.4s; }
.foe-hp-txt { font-weight: 800; opacity: 0.9; }
.foe-say { background: #fff; color: #5a1030; border-radius: 14px; padding: 8px 12px; font-weight: 800; font-size: 14px; font-style: italic; }
.foe-help { text-align: center; font-weight: 800; color: #8a2050; margin: 12px 0 4px; }
.foe-win { text-align: center; }
.foe-win h3 { color: var(--navy); font-size: 21px; margin: 4px 0 8px; }
.hikmah { background: #eafaf0; color: #1f5a37; border-radius: 14px; padding: 12px 14px; text-align: left; line-height: 1.55; font-size: 15px; }
.foe-lose { margin-top: 12px; background: #ffe8e8; color: #8a1a1a; border-radius: 12px; padding: 10px 12px; font-size: 14.5px; }
@media (max-width: 640px) {
  .arena { flex-direction: column; text-align: center; }
  .foe-kind { align-self: center; }
}

/* ───────── Lawan: nyawa, butang serang, senjata, skil ───────── */
.hikmah-banner { position: absolute; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 140px); transform: translate(-50%, -20px); opacity: 0; transition: 0.35s;
  width: min(440px, 92vw); background: linear-gradient(160deg, #3b1f5e, #6a2f8a); color: #fff; border-radius: 18px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); pointer-events: auto; z-index: 30; }
.hikmah-banner.show { opacity: 1; transform: translate(-50%, 0); }
.hb-head { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 16px; }
.hb-rew { margin-left: auto; background: rgba(255,255,255,0.18); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.hb-win { font-weight: 800; color: #ffd34d; margin: 6px 0 4px; font-size: 14px; }
.hb-lesson { font-size: 14px; line-height: 1.5; }
.hb-lesson .ar-inline { color: #ffe9a6; }
.hb-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; color: #fff; opacity: 0.7; font-size: 14px; }
.skill-head { text-align: center; }
.skill-ico { font-size: 56px; animation: floaty 2s ease-in-out infinite; }
.skill-modal .modal-head { background: linear-gradient(90deg, #8a6a00, #e0a81e); }

/* Video kartun dalam kad ilmu */
.vid-frame { width: 100%; max-width: 640px; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: #000; box-shadow: 0 8px 0 rgba(0,0,0,0.2); }
.vid-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.vid-thumb { position: relative; width: 100%; height: 100%; padding: 0; border: 0; background: #000; cursor: pointer; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; border-radius: 50%; background: rgba(230,30,40,0.92); color: #fff; font-size: 30px; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,0.4); }
.vid-picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.vid-pick { border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(255,255,255,0.2); color: #fff; font-weight: 800; font-size: 13px; }
.vid-pick.on { background: #fff; color: var(--g1); }
/* Puzzle */
.puzzle-modal .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 10px 12px 12px; }
.pz { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.pz-tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pz-tabs::-webkit-scrollbar { display: none; }
.pz-tab { flex: none; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font-weight: 800; font-size: 12.5px; color: var(--navy); white-space: nowrap; }
.pz-tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pz-tab.done { border-color: var(--green-2); }
.pz-tab.locked { opacity: 0.6; }
.pz-board { flex: 1 1 auto; min-height: 0; overflow-y: auto; background: linear-gradient(#f6ecd2, #efe0bb); border: 3px solid #c9a24a; border-radius: 16px; padding: 10px; }
.pz-qrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pz-q { flex: 1; font: 600 16px/1.3 var(--display); color: var(--navy); }
.pz-ref { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; border-radius: 12px; padding: 5px 8px; background: #fff; color: var(--navy); font-size: 18px; box-shadow: 0 2px 0 rgba(0,0,0,0.12); }
.pz-ref small { font: 700 10px var(--display); }
.pz-slots { display: grid; gap: 7px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.pz-slots.letters { grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); }
.pz-slot { min-height: 54px; border: 2px dashed #c9b48a; background: rgba(255,255,255,0.7); border-radius: 12px; padding: 6px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #9a8a66; }
.pz-slots.letters .pz-slot { min-height: 56px; padding: 0; }
.pz-slot.filled { border-style: solid; border-color: var(--green-2); background: #e3f8ec; color: #1f5a37; }
.pz-slot.nope { animation: shake 0.4s; border-color: var(--red); }
.pz-label { font-weight: 800; font-size: 12.5px; line-height: 1.3; color: var(--navy); text-align: center; }
.pz-val { font-weight: 800; font-size: 12.5px; line-height: 1.3; text-align: center; }
/* huruf Arab dalam kotak: ruang atas & bawah yang cukup supaya tidak terpotong, dan betul-betul di tengah */
.pz-label.ar, .pz-val.ar, .pz-piece.ar { font-family: var(--arabic); line-height: 1.9; display: inline-flex; align-items: center; justify-content: center; overflow: visible; }
.ilmu-chip.ar { font-family: var(--arabic); display: inline-flex; align-items: center; justify-content: center; overflow: visible; line-height: 1; }
.pz-label.ar { font-size: 24px; color: #b42323; }
.pz-label.ar .ar-inline, .pz-val.ar .ar-inline, .pz-piece.ar .ar-inline, .ilmu-chip.ar .ar-inline { font-size: inherit; line-height: inherit; color: inherit; }
.pz-val.ar { font-size: 26px; }
.pz-tray { flex: none; max-height: 34%; overflow-y: auto; background: #1f3d6e; border-radius: 14px; padding: 8px 10px; color: #fff; }
.pz-tray-h { font: 600 13px var(--display); margin-bottom: 6px; }
.pz-tray-h small { font: 600 11.5px var(--font); opacity: 0.8; }
.pz-pieces { display: flex; flex-wrap: wrap; gap: 6px; }
.pz-piece { position: relative; border: 2px solid #7fffd4; background: #fffdf4; color: var(--navy); border-radius: 12px; padding: 5px 10px; font-weight: 800; font-size: 12.5px; line-height: 1.3; cursor: grab; max-width: 260px; text-align: left; }
.pz-piece.ar { font-size: 24px; min-width: 46px; padding: 0 10px; }
.pz-piece.sel { background: #ffd34d; border-color: #b77d12; transform: translateY(-2px); box-shadow: 0 4px 0 rgba(0,0,0,0.25); }
.pz-count { font-style: normal; font-size: 11px; color: #2aa88a; font-family: var(--font); margin-left: 4px; }
.pz-locked { text-align: center; padding: 16px; color: #6a5a3a; font-weight: 700; }
.pz-tray .empty { color: rgba(255,255,255,0.75); margin: 0; font-size: 12.5px; }
.puzzle-modal .modal { height: min(720px, calc(100dvh - 32px)); }
@media (max-width: 640px) {
  .puzzle-modal { padding: 0; }
  .puzzle-modal .modal { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .pz-q { font-size: 14.5px; }
  .pz-slots { grid-template-columns: 1fr; gap: 6px; }
  .pz-slots.letters { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 5px; }
  .pz-slots.letters .pz-slot { min-height: 50px; }
  .pz-slot { min-height: 46px; padding: 5px 8px; }
  .pz-val.ar { font-size: 23px; }
  .pz-piece.ar { font-size: 22px; min-width: 42px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .puzzle-modal { padding: 0; }
  .puzzle-modal .modal { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .puzzle-modal .modal-body { padding: 6px 10px 8px; }
  .pz { display: grid; grid-template-columns: 1fr minmax(200px, 34%); grid-template-rows: auto 1fr; gap: 6px 10px; }
  .pz-tabs { grid-column: 1 / -1; }
  .pz-board { padding: 8px; }
  .pz-tray { max-height: none; }
  .pz-q { font-size: 14px; }
  .pz-slots.letters { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
  .pz-slot { min-height: 44px; }
}
/* ───────────── Almari (kostum) ───────────── */
.wd-hud { position: relative; }
.hud-badge { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #e0457b; color: #fff; font: 700 11px/20px var(--display); font-style: normal; box-shadow: 0 0 0 2px #fff; animation: badgePulse 1.4s ease-in-out infinite; }
@keyframes badgePulse { 50% { transform: scale(1.15); } }
.wardrobe-modal .modal.wide { width: min(1040px, 100%); }
.wardrobe-modal .modal-head { background: linear-gradient(90deg, #5b2a86, #2a4f8a); }
.wardrobe-modal .modal-body { padding: 0; }
.wd-wrap { display: grid; grid-template-columns: minmax(240px, 330px) 1fr; min-height: 0; }
.wd-left { background: radial-gradient(circle at 50% 70%, #fff3d0, #ffe2a8 55%, #f7c873); padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wd-cv { width: 100%; max-width: 300px; aspect-ratio: 440 / 480; height: auto; }
.wd-prev-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.wd-wallet { display: flex; flex-direction: column; align-items: center; gap: 8px; font: 700 16px var(--display); color: var(--navy); }
.wd-boxbtn { background: linear-gradient(#c58bff, #8a4fd6); border-color: #6b2fa0; color: #fff; animation: boxGlow 1.8s ease-in-out infinite; }
.wd-boxbtn:disabled { animation: none; opacity: 0.55; filter: grayscale(0.6); }
@keyframes boxGlow { 50% { box-shadow: 0 0 18px #c58bff; } }
.wd-hint { font-size: 12.5px; color: #6b5a3a; text-align: center; margin: 0; }
.wd-right { padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wd-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.wd-tab { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; padding: 6px 8px; border-radius: 12px; border: 2px solid transparent; background: #f3ead6; color: var(--navy); }
.wd-tab span { font-size: 22px; }
.wd-tab small { font: 600 11px var(--display); white-space: nowrap; }
.wd-tab.on { background: #fff; border-color: var(--gold); box-shadow: 0 3px 0 rgba(0,0,0,0.12); }
.wd-info { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; color: var(--navy); }
.wd-info b { font: 700 18px var(--display); }
.wd-info .wd-hint { flex-basis: 100%; text-align: left; }
.wd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; overflow-y: auto; max-height: min(62vh, 560px); padding: 4px 2px 8px; }
.wd-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 6px 8px; border-radius: 16px; background: #fff; border: 3px solid var(--rc); box-shadow: 0 4px 0 rgba(0,0,0,0.12); cursor: pointer; text-align: center; transition: transform 0.12s; }
.wd-card:hover { transform: translateY(-2px); }
.wd-card.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--rc); }
.wd-card.r-epik, .wd-card.r-legenda { background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--rc) 18%, #fff)); }
.wd-card.r-legenda::after { content: ''; position: absolute; inset: 0; border-radius: 13px; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.75) 50%, transparent 65%); background-size: 250% 100%; animation: shine 2.6s linear infinite; pointer-events: none; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.wd-card.locked .wd-thumb { filter: saturate(0.65); opacity: 0.85; }
.wd-rar { position: absolute; top: 0; left: 0; right: 0; background: var(--rc); color: #fff; font: 700 10px/16px var(--display); border-radius: 12px 12px 0 0; letter-spacing: 0.5px; text-transform: uppercase; }
.wd-thumb { height: 64px; display: grid; place-items: center; }
.wd-emoji { font-size: 40px; line-height: 64px; }
.wd-name { font: 600 12.5px/1.2 var(--display); color: var(--navy); min-height: 30px; display: flex; align-items: center; }
.wd-own { font: 700 12px var(--display); color: #6b7a8c; }
.wd-own.on { color: var(--green); }
.wd-buy { background: linear-gradient(#ffe48a, #f4b63f); border-color: #b77d12; color: #5a3a00; }
@media (max-width: 720px) {
  .wd-wrap { grid-template-columns: 1fr; }
  .wd-left { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 8px; }
  .wd-cv { max-width: 150px; }
  .wd-left .wd-hint { display: none; }
  .wd-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); max-height: 46vh; }
}

/* Kotak Misteri — roda putar */
.unbox { display: flex; flex-direction: column; gap: 14px; }
.reel-window { position: relative; overflow: hidden; height: 120px; border-radius: 16px; background: linear-gradient(#2b1d4a, #160e2c); box-shadow: inset 0 0 24px rgba(0,0,0,0.6); }
.reel-strip { display: flex; gap: 8px; padding: 12px 0; will-change: transform; }
.reel-tile { flex: 0 0 88px; height: 96px; border-radius: 12px; background: #fff; border: 3px solid var(--rc); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: 0 0 10px color-mix(in srgb, var(--rc) 60%, transparent); }
.reel-tile span { font-size: 34px; }
.reel-tile small { font: 600 9.5px/1.1 var(--display); color: var(--navy); padding: 0 3px; text-align: center; max-height: 22px; overflow: hidden; }
.reel-needle { position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #ffd34d; box-shadow: 0 0 12px #ffd34d; }
.reel-needle::before, .reel-needle::after { content: ''; position: absolute; left: -7px; border: 9px solid transparent; }
.reel-needle::before { top: 0; border-top-color: #ffd34d; }
.reel-needle::after { bottom: 0; border-bottom-color: #ffd34d; }
.reel-result:empty { display: none; }
.reel-win { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; border-radius: 18px; background: #fff; border: 4px solid var(--rc); overflow: hidden; animation: winPop 0.5s cubic-bezier(.2,1.5,.4,1); }
@keyframes winPop { from { opacity: 0; transform: scale(0.6); } }
.reel-win small { font: 700 12px var(--display); color: var(--rc); text-transform: uppercase; letter-spacing: 1px; position: relative; }
.reel-win b { font: 700 20px var(--display); color: var(--navy); position: relative; }
.rw-thumb { position: relative; }
.rw-burst { position: absolute; inset: -60%; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 35%, transparent) 0 10deg, transparent 10deg 20deg); animation: spinBurst 6s linear infinite; }
@keyframes spinBurst { to { transform: rotate(360deg); } }

/* Hadiah Harian */
.daily p { margin: 0 0 12px; }
.dl-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dl-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 12px; background: #f3ead6; color: var(--navy); }
.dl-card span { font-size: 22px; }
.dl-card small { font: 600 10px var(--display); }
.dl-card b { font: 700 12px var(--display); }
.dl-card.got { opacity: 0.5; }
.dl-card.today { background: linear-gradient(#fff3c4, #ffd34d); box-shadow: 0 0 0 3px var(--gold-dark); animation: badgePulse 1.4s ease-in-out infinite; }
@media (max-width: 480px) { .dl-row { grid-template-columns: repeat(4, 1fr); } }

/* Emote */
.emote-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.emote-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 16px; border: 0; background: linear-gradient(#fffaf0, #f3e3bf); color: var(--navy); box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.emote-btn span { font-size: 34px; }
.emote-btn small { font: 600 13px var(--display); }
.emote-btn.locked { opacity: 0.5; }

/* ───────── Skrin melintang / rendah: dek pelajaran skrin penuh, kandungan dalam lajur ───────── */
@media (max-height: 520px) and (orientation: landscape) {
  .modal-backdrop { padding: 6px; }
  .modal { max-height: calc(100dvh - 12px); border-radius: 16px; }
  .modal-head { padding: 7px 12px; gap: 8px; }
  .modal-head h2 { font-size: 16px; }
  .modal-ico { font-size: 18px; }
  .modal-x { width: 30px; height: 30px; font-size: 13px; }
  .modal-body { padding: 10px 14px; }
  .modal-foot { padding: 7px 12px; }

  .deck-modal { padding: 0; }
  .deck-modal .modal { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .deck-modal .modal-foot { padding: 5px 12px; }
  .deck-nav { width: 34px; height: 34px; font-size: 20px; }
  .deck-next { padding: 7px 14px; font-size: 14px; }
  /* kandungan mengalir ke 2 lajur (3 bagi skrin lebar) supaya muat tanpa skrol */
  .slide-in { display: block; min-height: 0; columns: 2; column-gap: 26px; padding: 12px 22px 14px; text-align: center; }
  .slide-in > * { break-inside: avoid; margin: 0 auto 10px; max-width: 100%; }
  .slide-in > .formula, .slide-in > .parts, .slide-in > .big-letters, .slide-in > .tiles, .slide-in > .step-cards, .slide-in > .hmeter { display: flex; }
  .slide-in > .tiles { display: grid; }
  .slide-in > .step-cards { display: grid; }
  .slide-in > .hmeter { display: grid; }
  .slide-in > .pop { display: block; width: fit-content; }
  .slide-in > .parts.pop, .slide-in > .term-box, .slide-in > .tip { width: auto; }
  .sl-h { font-size: 17px; column-span: none; }
  .sl-foot { font-size: 13px; }
  .slide-in > .swipe-hint { display: none; }
  .cv-icon { font-size: 46px; margin-bottom: 0; }
  .cv-ar { font-size: 32px; line-height: 1.5; }
  .cv-title { font-size: 22px; }
  .cv-family { font-size: 11.5px; padding: 3px 12px; }
  .bubble { font-size: 14px; padding: 9px 14px; border-radius: 16px; }
  .part { min-width: 96px; padding: 8px 10px; border-radius: 16px; box-shadow: 0 5px 0 rgba(0,0,0,0.15); }
  .part-ic { font-size: 26px; }
  .part b { font-size: 16px; }
  .part span { font-size: 12px; }
  .plus, .f-op { font-size: 24px; }
  .formula { gap: 6px; }
  .f-tile { padding: 8px 10px; min-width: 84px; font-size: 14px; border-radius: 14px; }
  .f-tile .ar-inline { font-size: 1.6em; line-height: 1.35; }
  .f-lbl { font-size: 11px; padding: 2px 6px; }
  .f-out { padding: 8px 12px; min-width: 130px; border-radius: 16px; }
  .f-out-ic { font-size: 26px; }
  .f-out b { font-size: 14px; }
  .big-letters { gap: 6px; }
  .bl, .bl.pop { width: 52px; height: 74px; font-size: 28px; border-radius: 12px; padding: 2px 0 5px; }
  .bl small { font-size: 9.5px; }
  .mn-banner { padding: 6px 14px; border-radius: 14px; }
  .mn-banner b { font-size: 24px; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
  .tile { padding: 9px 8px; gap: 3px; border-radius: 14px; }
  .tile-ic, .tile-sym { font-size: 26px; }
  .tile b { font-size: 13.5px; }
  .tile span { font-size: 12px; }
  .term-box { font-size: 12.5px; padding: 8px 12px; line-height: 1.45; }
  .step-cards { gap: 7px; }
  .step-card { padding: 8px 10px; gap: 8px; border-radius: 12px; }
  .step-card p { font-size: 13px; line-height: 1.45; }
  .step-n { width: 24px; height: 24px; font-size: 12px; }
  .slide .tip { font-size: 12.5px; padding: 8px 10px; margin-top: 0; }
  .hmeter { padding: 10px; gap: 7px; border-radius: 16px; }
  .hm-beats .b { width: 22px; height: 22px; }
  .slide-example .ex-card { padding: 8px 10px; margin-bottom: 10px; }
  .slide-example .ayah { font-size: 25px; line-height: 1.8; }
  .ex-note, .ex-meta { font-size: 12px; }
  .ex-sub { font-size: 12px; }
  .vid-frame { max-width: 360px; border-radius: 12px; }
  .slide-final .cv-icon { font-size: 40px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  /* tajuk dek disembunyikan (nama hukum ada di halaman pertama); ✕ terapung di penjuru */
  .deck-modal .modal { position: relative; }
  .deck-modal .modal-head { position: absolute; top: 6px; right: 8px; z-index: 3; padding: 0; background: none; }
  .deck-modal .modal-head h2, .deck-modal .modal-head .modal-ico { display: none; }
  .deck-modal .modal-x { background: rgba(0,0,0,0.28); }
  .slide-in { padding-right: 46px; }
  /* contoh: kad mendatar, perkataan bertajwid sahaja (ayat penuh boleh didengar dengan butang "Ayat") */
  .slide-example .slide-in { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; align-content: start; }
  .slide-example .slide-in > .sl-h { grid-column: 1 / -1; margin: 0; }
  .slide-example .slide-in > .ex-sub { display: none; }
  .slide-example .ex-card { margin: 0; padding: 6px 10px; display: grid; grid-template-columns: minmax(80px, auto) 1fr; grid-template-areas: "ayah meta" "ayah note" "ayah act"; column-gap: 10px; align-items: center; }
  .slide-example .ayah { grid-area: ayah; text-align: center; line-height: 2.1; font-size: 25px; }
  .slide-example .ayah .w:not(.hl), .slide-example .ayah-no, .slide-example .ex-ms, .slide-example .ex-tr { display: none; }
  .slide-example .ex-meta { grid-area: meta; font-size: 11.5px; }
  .slide-example .ex-ref { font-size: 11.5px; }
  .slide-example .ex-note { grid-area: note; font-size: 11.5px; line-height: 1.35; margin-top: 0; }
  .slide-example .ex-note .ar-inline { font-size: 1.25em; }
  .slide-example .ex-actions { grid-area: act; margin-top: 3px; gap: 5px; }
  .slide-example .btn-play { padding: 4px 9px; font-size: 11.5px; }
  .slide-example .btn-play.mode-ayah .lbl, .slide-example .btn-play.rec .lbl { display: none; }
  .slide-example .btn-play.mode-ayah::after { content: 'Ayat'; }
  .slide-example .btn-play.rec::after { content: 'Sebut'; }
}
@media (max-height: 520px) and (orientation: landscape) {
  /* jubin: mendatar (ikon kiri, teks kanan) dan merentang lebar penuh */
  .tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-width: none; width: 100%; }
  .tile { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ic h" "ic p"; column-gap: 8px; row-gap: 1px; align-items: center; text-align: left; padding: 6px 10px; }
  .tile > :first-child { grid-area: ic; }
  .tile b { grid-area: h; }
  .tile span { grid-area: p; }
  .tile-ic, .tile-sym { font-size: 24px; line-height: 1.3; }
  .tile-sym { line-height: 1.1; min-width: 30px; text-align: center; }
  /* kad nota mengalir merentasi lajur (bukan satu blok) */
  .slide-in > .step-cards { display: block; break-inside: auto; width: 100%; }
  .step-cards .step-card { break-inside: avoid; margin-bottom: 7px; }
  .slide-notes .sl-h { margin-bottom: 8px; }
  /* halaman hukum: bahagian disusun dalam grid; bahagian lebar (huruf panjang, jubin) merentang penuh */
  .slide-rule .slide-in { columns: auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px 18px; align-content: start; align-items: start; }
  .slide-rule .rule-sec { gap: 7px; margin: 0; }
  .slide-rule .rule-sec.wide { grid-column: 1 / -1; }
  /* bahagian tanpa pasangan di sebelahnya juga merentang penuh */
  .slide-rule .rule-sec:not(.wide):has(+ .wide), .slide-rule .wide + .rule-sec:not(.wide):last-child, .slide-rule .rule-sec:only-child { grid-column: 1 / -1; }
  .slide-rule .rule-sec:not(.wide):has(+ .wide):first-child { flex-direction: row; justify-content: center; align-items: center; gap: 14px; }
  .rule-sec.wide .big-letters { max-width: none; gap: 5px; }
  .rule-sec.wide .bl, .rule-sec.wide .bl.pop { width: 46px; height: 64px; font-size: 24px; }
  .slide-rule .formula { flex-wrap: nowrap; }
  .slide-cover .term-box { font-size: 12px; }
}
@media (max-height: 520px) and (orientation: landscape) and (min-width: 700px) {
  .slide-notes .slide-in { columns: 3; column-gap: 20px; }
  .slide-notes .step-card p { font-size: 12.5px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .wardrobe-modal .modal.wide { width: 100%; height: calc(100dvh - 12px); }
  .wardrobe-modal .modal-body { flex: 1; min-height: 0; display: flex; }
  .wd-wrap { flex: 1; min-height: 0; grid-template-columns: 210px 1fr; }
  .wd-left { padding: 6px 8px; gap: 6px; justify-content: center; }
  .wd-cv { max-width: none; width: auto; height: min(44vh, 170px); }
  .wd-left .wd-hint { display: none; }
  .wd-prev-btns .btn { padding: 5px 10px; font-size: 12px; }
  .wd-wallet { font-size: 14px; gap: 5px; }
  .wd-boxbtn { padding: 7px 12px; font-size: 13px; }
  .wd-right { padding: 8px; gap: 6px; min-height: 0; }
  .wd-tab { min-width: 62px; padding: 4px 6px; }
  .wd-tab span { font-size: 18px; }
  .wd-tab small { font-size: 10.5px; }
  .wd-info b { font-size: 15px; }
  .wd-grid { flex: 1; max-height: none; min-height: 0; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .wd-card { padding: 18px 5px 6px; }
  .wd-name { font-size: 11.5px; min-height: 26px; }
  .reel-window { height: 104px; }
  .reel-tile { flex-basis: 80px; height: 82px; }
}

/* Tukar peranti (had peranti penuh) */
.dev-wrap p { margin: 0 0 10px; line-height: 1.5; }
.dev-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.dev-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--navy); text-align: left; }
.dev-item:hover { border-color: var(--gold); background: #fffaf0; }
.dev-ico { font-size: 26px; flex: none; }
.dev-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dev-info b { font: 600 15px var(--display); }
.dev-info small { font-size: 12.5px; color: var(--muted); }
.dev-go { flex: none; font: 700 13px var(--display); color: #fff; background: var(--navy); border-radius: 999px; padding: 6px 12px; }
.dev-note { font-size: 13px; color: #4a5a3a; background: #eafaf0; border-radius: 12px; padding: 10px 12px; }
