/* Taman Ilmu. Gerak ikut aturan app-motion (Emil Kowalski): ease-out, UI di bawah 300 ms,
   scale mulai 0.95, hanya transform/opacity, reduced motion = lebih lembut. */
:root {
  color-scheme: only light; /* satu tema terang yang dirancang; auto-dark browser dimatikan lewat ini */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-pop: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur-press: 120ms;
  --dur-ui: 180ms;
  --dur-ui-max: 300ms;
  --dur-modal: 250ms;
  --dur-exit: 150ms;
  --stagger: 40ms;

  --bg: #fff8ec;
  --ink: #2b2d42;
  --muted: #6b6f86;
  --card: #ffffff;
  --line: #ece3d2;
  --shadow: #e4d8c2;
  --good: #0e9f6e;
  --good-bg: #dcf7ea;
  --bad: #e5484d;
  --bad-bg: #ffe4e4;
  --sun: #ffc93c;
  --c: #2f6fed;
  --radius: 22px;
  --font: "Baloo 2", "Nunito", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-ar: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", "Arabic Typesetting", "Segoe UI", "Geeza Pro", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 18px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, #ffe9c2 0, transparent 32%),
    radial-gradient(circle at 92% 18%, #e3f4ff 0, transparent 30%),
    radial-gradient(circle at 70% 96%, #e9f9ee 0, transparent 34%),
    var(--bg);
  -webkit-tap-highlight-color: transparent;
}
button, a, input { font: inherit; color: inherit; }
button, a, [role="button"], .choice, input[type="range"] { touch-action: manipulation; }
:focus-visible { outline: 4px solid #ffb703; outline-offset: 3px; border-radius: 14px; }
[hidden] { display: none !important; }

#app {
  max-width: 1120px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

/* ---------- tombol dasar ---------- */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 52px; height: 52px; flex: none;
  border: 0; border-radius: 16px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--shadow);
  font-size: 1.5rem; text-decoration: none; cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-press) ease;
}
.icon-btn:active { transform: scale(0.95); }

.ti-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 60px; padding: 10px 28px;
  border: 0; border-radius: 999px;
  background: var(--c); color: #fff;
  font-size: 1.35rem; font-weight: 800; text-decoration: none; cursor: pointer;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 70%, #000);
  transition: transform var(--dur-press) var(--ease-out), box-shadow var(--dur-press) var(--ease-out), opacity var(--dur-ui) ease;
}
.ti-btn:active { transform: translateY(3px) scale(0.98); box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 70%, #000); }
.ti-btn:disabled { opacity: 0.5; cursor: default; }
.ti-btn.is-ghost { background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--shadow); }

/* ---------- beranda ---------- */
.home-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding: 6px 2px 4px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px;
  background: linear-gradient(145deg, #1f8a5b, #0e9f6e); font-size: 2rem;
  box-shadow: 0 4px 0 #0b6b4a;
}
.brand h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1; letter-spacing: -0.01em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.brand-count { display: inline-block; margin-top: 6px; padding: 3px 12px; border-radius: 999px; background: var(--good-bg); color: var(--good); font-weight: 800; font-size: 0.82rem; }
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 5px; gap: 4px; border-radius: 18px; background: var(--card); box-shadow: 0 3px 0 var(--shadow); }
.seg-btn {
  min-width: 64px; min-height: 44px; border: 0; border-radius: 13px; background: transparent;
  font-weight: 800; font-size: 1.1rem; cursor: pointer;
  transition: background-color var(--dur-ui) ease, color var(--dur-ui) ease, transform var(--dur-press) var(--ease-out);
}
.seg-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg-btn:active { transform: scale(0.97); }
.star-total {
  display: inline-flex; align-items: center; gap: 2px; min-height: 52px; padding: 0 16px;
  border-radius: 16px; background: var(--card); box-shadow: 0 3px 0 var(--shadow); font-weight: 800; font-size: 1.2rem;
}
.star-total small { color: var(--muted); font-weight: 600; }
.star { color: #d9d2c3; }
.star.is-on { color: var(--sun); text-shadow: 0 1px 0 #d99a00; }
.level-note { margin: 10px 2px 0; color: var(--muted); font-size: 0.95rem; }

.tabs { display: flex; gap: 8px; margin: 14px 0 16px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tab {
  flex: none; min-height: 48px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--card); box-shadow: 0 3px 0 var(--shadow); font-weight: 700; cursor: pointer;
  transition: background-color var(--dur-ui) ease, color var(--dur-ui) ease, transform var(--dur-press) var(--ease-out);
}
.tab[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: 0 3px 0 #11121c; }
.tab-n { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.08); font-size: 0.8rem; }
.tab[aria-pressed="true"] .tab-n { background: rgba(255, 255, 255, 0.2); }
.tab:active { transform: scale(0.97); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.card {
  position: relative; display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center;
  min-height: 112px; padding: 14px 14px 28px 12px;
  border-radius: var(--radius); background: var(--card); text-decoration: none;
  box-shadow: 0 5px 0 var(--shadow); border-top: 6px solid var(--c);
  transition: transform var(--dur-press) var(--ease-out), box-shadow var(--dur-press) var(--ease-out);
}
.card:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--shadow); }
  .icon-btn:hover, .tab:hover { background-color: #fffdf8; }
}
.card-icon {
  display: grid; place-items: center; width: 72px; height: 72px; border-radius: 20px;
  background: color-mix(in srgb, var(--c) 14%, #fff); font-size: 2.4rem; line-height: 1;
}
.card-icon.ti-arabic { font-size: 2.6rem; padding-bottom: 8px; }
.card-body { display: grid; gap: 1px; min-width: 0; }
.card-cat { font-size: 0.78rem; font-weight: 800; color: var(--c); text-transform: uppercase; letter-spacing: 0.04em; }
.card-title { font-size: 1.18rem; font-weight: 800; line-height: 1.15; }
.card-desc { font-size: 0.88rem; color: var(--muted); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-nilai { display: block; margin-top: 2px; font-size: 0.8rem; font-weight: 800; color: var(--good); }
.card-stars { position: absolute; right: 14px; bottom: 6px; font-size: 1rem; line-height: 1; letter-spacing: 1px; }
.empty { color: var(--muted); }
.home-foot { display: grid; justify-items: center; gap: 4px; margin: 26px 0 10px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.ajak-btn { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); padding: 8px 18px; font: inherit; font-weight: 800; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--shadow); transition: transform var(--dur-press) var(--ease-out); }
.ajak-btn:active { transform: scale(0.96); }
.ajak-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; padding: 12px 16px; border-radius: var(--radius); background: #fff4cc; border: 2px solid #f2c94c; }
.klaim-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; padding: 12px 16px; border-radius: var(--radius); background: #e7f9ef; border: 2px solid var(--good); }
.ajak-txt { flex: 1 1 260px; min-width: 0; font-weight: 700; }
.badge-share { margin-top: 6px; border: 0; border-radius: 999px; background: #fff4cc; cursor: pointer; padding: 6px 14px; font: inherit; font-size: 0.85rem; font-weight: 800; color: #9a6b00; box-shadow: 0 3px 0 #ecd9a0; transition: transform var(--dur-press) var(--ease-out); }
.badge-share:active { transform: scale(0.96); }

/* ---------- strip pemain (level, XP, nama, lencana, papan) ---------- */
.player-strip {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 14px;
  border-radius: var(--radius); background: var(--card); box-shadow: 0 5px 0 var(--shadow);
}
.strip-lvl {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 4px 10px 4px 4px;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer; text-align: left;
  transition: transform var(--dur-press) var(--ease-out);
}
.strip-lvl:active { transform: scale(0.96); }
.lvl-ring { width: 52px; height: 52px; flex: none; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--good); stroke-width: 5; stroke-linecap: round; }
.ring-n { font-size: 19px; font-weight: 800; fill: var(--ink); font-family: var(--font); }
.strip-meta { display: grid; line-height: 1.15; }
.strip-meta b { font-size: 0.98rem; }
.strip-nama { color: var(--muted); font-size: 0.9rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-mid { display: grid; gap: 4px; flex: 1 1 200px; min-width: 170px; }
.xp-bar { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; }
.xp-fill {
  display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0e9f6e, #37c186);
  transform-origin: left center; transform: scaleX(0);
  transition: transform var(--dur-ui-max) var(--ease-out);
}
.xp-txt { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.strip-badges {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; padding: 4px 10px;
  justify-self: start; border: 0; border-radius: 999px; background: #fff4cc; cursor: pointer;
  font-size: 0.95rem; font-weight: 800; box-shadow: 0 3px 0 #ecd9a0;
  transition: transform var(--dur-press) var(--ease-out);
}
.strip-badges:active { transform: scale(0.96); }
.strip-badges .tea-ic { font-size: 1.05rem; line-height: 1; }
.strip-more { color: #9a6b00; font-size: 0.82rem; }
.strip-board { min-height: 52px; padding: 8px 20px; font-size: 1.05rem; flex: none; }

/* ---------- kartu tantangan pekan ---------- */
.tantangan {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 14px;
  border-radius: var(--radius); background: #fff4cc; border: 2px dashed #f2c94c;
}
.tantangan.is-done { background: var(--good-bg); border-color: var(--good); }
.tan-icon { font-size: 2rem; line-height: 1; }
.tan-body { display: grid; gap: 1px; flex: 1 1 220px; min-width: 0; }
.tan-body b { font-size: 1.02rem; }
.tan-note { color: var(--muted); font-size: 0.88rem; }
.tan-done { font-weight: 800; color: var(--good); animation: ti-pop 240ms var(--ease-pop); }
.tan-go { min-height: 48px; padding: 6px 20px; font-size: 1rem; }
.tan-ajak { min-height: 48px; padding: 6px 14px; font-size: 1rem; }

/* ---------- coba 30 detik ---------- */
.coba-go { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 0 0 10px; padding: 12px 16px; font-size: 1.15rem; }
.coba-sub { font-weight: 400; font-size: 0.85rem; opacity: 0.85; }
.trust-strip { display: block; text-align: center; margin: 0 0 10px; padding: 9px 14px; border-radius: 999px; background: var(--card); box-shadow: 0 3px 0 var(--shadow); font-weight: 700; font-size: 0.95rem; color: inherit; text-decoration: none; }
.lapor-mini { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin: 0 0 10px; padding: 9px 16px; border: 0; border-radius: 999px; background: var(--card); box-shadow: 0 3px 0 var(--shadow); font-weight: 800; font-size: 0.95rem; color: inherit; cursor: pointer; }
.lapor-mini b { color: var(--good); }

/* ---------- populer pekan ini ---------- */
.populer { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); box-shadow: 0 5px 0 var(--shadow); border-top: 6px solid var(--sun); }
.pop-judul { margin: 0 0 8px; font-size: 1.1rem; }
.pop-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; text-decoration: none; color: inherit; }
.pop-row:active { background: var(--good-bg); }
.pop-rank { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--sun); font-weight: 800; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; }
.pop-icon { font-size: 1.5rem; line-height: 1; }
.pop-title { flex: 1 1 auto; min-width: 0; font-weight: 800; }
.pop-count { flex: none; font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.populer .ti-btn { width: 100%; margin-top: 8px; }
.card-pop { position: absolute; top: 8px; right: 8px; padding: 2px 10px; border-radius: 999px; background: var(--sun); font-size: 0.75rem; font-weight: 800; }

/* ---------- banner nama pertama kali ---------- */
.nama-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 12px 16px;
  border-radius: var(--radius); background: var(--good-bg); border: 2px solid var(--good);
}
.nama-banner-txt { flex: 1 1 260px; min-width: 0; font-weight: 700; }
.nama-btn { min-height: 48px; padding: 6px 20px; font-size: 1rem; }
.nama-later {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-weight: 700; text-decoration: underline; padding: 8px;
}

/* ---------- kartu game: pips kemahiran ---------- */
.card-foot { position: absolute; right: 14px; bottom: 6px; display: inline-flex; align-items: center; gap: 8px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 9px; height: 9px; background: #e6dfcf; transform: rotate(45deg) scale(0.85); border-radius: 2px; }
.pips i.is-on { background: var(--c); }
.pips { align-items: center; }
.pips-lv { font-size: 0.75rem; font-weight: 800; color: var(--muted); margin-left: 2px; }
.card-best { font-size: 0.85rem; color: var(--muted); font-weight: 800; }

/* ---------- layar dalam (papan, lencana, nama) ---------- */
.page-head { display: flex; align-items: center; gap: 12px; padding: 6px 2px 14px; }
.page-title h2 { margin: 0; font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.1; }
.page-title p { margin: 3px 0 0; color: var(--muted); font-size: 0.92rem; }

/* papan juara */
.board-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.board-status { min-height: 26px; margin: 0 2px 8px; color: var(--muted); font-size: 0.95rem; }
.board-rows { display: grid; gap: 8px; }
.board-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-radius: 18px; background: var(--card); box-shadow: 0 3px 0 var(--shadow);
}
.board-row.is-top { background: #fffdf4; }
.board-row.is-me { background: var(--good-bg); border: 2px solid var(--good); padding: 8px 14px; }
.board-rank { flex: none; min-width: 40px; text-align: center; font-weight: 800; font-size: 1.15rem; }
.board-name { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-xp { flex: none; font-weight: 800; color: var(--good); }
.board-stars { flex: none; color: var(--muted); font-weight: 700; font-size: 0.95rem; }
.board-pamer, .board-tantang { flex: none; padding: 8px 14px; font-size: 0.9rem; }
.board-empty, .board-note { margin: 8px 2px; color: var(--muted); font-size: 0.95rem; }

/* lencana */
.badge-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.badge-card {
  display: grid; gap: 2px; padding: 14px; border-radius: var(--radius);
  background: var(--card); box-shadow: 0 5px 0 var(--shadow);
}
.badge-card.is-earned { border-top: 6px solid var(--sun); }
.badge-ic { font-size: 2.1rem; line-height: 1.2; }
.badge-name { font-size: 1.05rem; }
.badge-how { color: var(--muted); font-size: 0.88rem; }
.serti-list { display: grid; gap: 8px; }
.serti-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 18px; background: var(--card); box-shadow: 0 3px 0 var(--shadow); }
.serti-ic { font-size: 1.8rem; }
.serti-nama { flex: 1; font-weight: 800; }
.serti-aksi { display: flex; gap: 8px; }
.serti-aksi .ti-btn { min-height: 44px; padding: 4px 14px; font-size: 0.95rem; }
.serti-note { color: var(--muted); font-size: 0.88rem; font-weight: 700; }
.badge-when { color: #9a6b00; font-size: 0.8rem; font-weight: 700; }
.badge-card:not(.is-earned) .badge-ic { filter: grayscale(1); opacity: 0.5; }
.badge-card:not(.is-earned) .badge-name { color: var(--muted); }

/* ganti nama */
.name-box {
  display: grid; gap: 14px; justify-items: center; max-width: 460px;
  padding: 20px 16px; border-radius: var(--radius); background: var(--card); box-shadow: 0 5px 0 var(--shadow);
}
.name-input {
  width: 100%; min-height: 60px; padding: 8px 18px; text-align: center;
  border: 3px solid var(--line); border-radius: 18px; font-size: 1.4rem; font-weight: 800;
}
.name-input:focus { outline: none; border-color: var(--good); }
.name-emoji { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.name-emoji-btn {
  width: 52px; height: 52px; border: 0; border-radius: 16px; background: #fff4cc;
  box-shadow: 0 3px 0 #ecd9a0; font-size: 1.5rem; cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out);
}
.name-emoji-btn:active { transform: scale(0.92); }
.name-err { min-height: 24px; margin: 0; color: var(--bad); font-weight: 700; font-size: 0.95rem; }

/* ---------- hasil: chip XP, naik level, tantangan ---------- */
.xp-chip {
  margin: 2px 0 0; display: inline-block; align-self: center; padding: 4px 18px;
  border-radius: 999px; background: var(--good-bg); color: var(--good); font-weight: 800; font-size: 1.2rem;
}
.result-card { display: flex; flex-direction: column; align-items: center; }
.lvl-chip { margin: 2px 0 0; display: inline-block; align-self: center; padding: 4px 18px; border-radius: 999px; background: #fff4d6; color: #9a6b00; font-weight: 800; font-size: 1.1rem; }
.lvl-naik { margin: 6px 0 0; font-weight: 800; color: var(--good); font-size: 1.15rem; }
.lvl-tantang { margin: 6px 0 0; font-weight: 800; color: #9a6b00; font-size: 1rem; }
.level-up { margin: 6px 0 0; font-weight: 800; color: var(--good); font-size: 1.15rem; }
.teman-bonus { margin: 6px 0 0; font-weight: 800; color: #9a6b00; font-size: 1rem; }
.streak-party { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 6px 0 0; }
.streak-chip { font-weight: 800; font-size: 1.05rem; }
.challenge-done { margin: 4px 0 0; font-weight: 800; color: #9a6b00; font-size: 1rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.level-ajak { margin: 4px 0 0; font-weight: 800; color: var(--c); font-size: 1rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.duel-result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 6px 0 0; padding: 10px 14px; border-radius: var(--radius); background: #fff4cc; border: 2px dashed #f2c94c; font-weight: 800; }

/* ---------- toast lencana ---------- */
.ti-toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  border-radius: 999px; background: var(--ink); color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); font-size: 1.05rem;
  transform: translateX(-50%);
  animation: ti-toast-in var(--dur-modal) var(--ease-out);
}
.ti-toast-ic { font-size: 1.5rem; }
.ti-toast.is-out { opacity: 0; transition: opacity var(--dur-exit) ease; }
@keyframes ti-toast-in { from { opacity: 0; transform: translateX(-50%) translateY(14px); } }

/* ---------- layar main ---------- */
.play { display: grid; grid-template-rows: auto auto 1fr; min-height: calc(100dvh - 28px); gap: 10px; position: relative; }
.play-head { display: flex; align-items: center; gap: 10px; }
.play-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; }
.play-icon { flex: none; }
.play-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-level { flex: none; padding: 2px 9px; border-radius: 999px; background: var(--c); color: #fff; font-size: 0.75rem; }
.progress { flex: 0 1 220px; height: 16px; border-radius: 999px; background: var(--card); box-shadow: inset 0 2px 0 var(--line); overflow: hidden; }
.progress-bar {
  display: block; height: 100%; border-radius: inherit; background: var(--c);
  transform-origin: left center; transform: scaleX(0);
  transition: transform var(--dur-ui-max) var(--ease-out);
}
.prompt {
  display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 10px 10px 10px 20px;
  border-radius: var(--radius); background: var(--card); box-shadow: 0 4px 0 var(--shadow);
}
.prompt-text { flex: 1; margin: 0; font-size: clamp(1.2rem, 3.2vw, 1.7rem); font-weight: 800; line-height: 1.2; }
.say-again { background: color-mix(in srgb, var(--c) 14%, #fff); }
.stage {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 16px;
  padding: 8px 0 18px; min-height: 0; overflow-y: auto;
}
.stage > :first-child { margin-top: auto; }
.stage > :last-child { margin-bottom: auto; }

/* ---------- pilihan jawaban ---------- */
.ti-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: 100%; max-width: 860px; }
.ti-choices.is-col { flex-direction: column; align-items: stretch; max-width: 620px; }
.ti-choices.is-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; }
.choice {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 108px; min-height: 84px; padding: 12px 20px;
  border: 3px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: 0 5px 0 var(--shadow);
  font-size: 1.45rem; font-weight: 800; line-height: 1.15; text-align: center; cursor: pointer;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-ui) ease, border-color var(--dur-ui) ease, opacity var(--dur-ui) ease;
}
.lvl-tk .choice { min-width: 120px; min-height: 96px; font-size: 1.7rem; }
.choice:active:not(:disabled) { transform: scale(0.96); }
.choice:disabled { cursor: default; opacity: 0.45; }
.choice[aria-disabled="true"] { cursor: default; }
.choice.is-big { min-width: 130px; min-height: 130px; font-size: 3.2rem; }
.choice.is-correct { opacity: 1; background: var(--good-bg); border-color: var(--good); animation: ti-yay var(--dur-ui-max) var(--ease-pop); }
.choice.is-wrong { background: var(--bad-bg); border-color: var(--bad); animation: ti-shake var(--dur-ui-max) var(--ease-in-out); }
.choice.is-hint { border-color: var(--sun); animation: ti-hint 900ms var(--ease-in-out) 3; } /* motion-ok: petunjuk berkedip lembut 3 kali, jarang muncul */
@keyframes ti-yay { 50% { transform: scale(1.06); } }
@keyframes ti-shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes ti-hint { 50% { transform: scale(1.05); } }

.pop-in { animation: ti-pop var(--dur-ui) var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--stagger)); }
@keyframes ti-pop { from { opacity: 0; transform: scale(0.95); } }

/* ---------- blok bantu untuk game ---------- */
.ti-arabic { font-family: var(--font-ar); direction: rtl; line-height: 1.5; font-weight: 400; }
.choice .ti-arabic, .choice.ti-arabic { font-size: 3rem; padding-bottom: 6px; }
.ti-big { font-size: clamp(3rem, 12vw, 6rem); line-height: 1.1; margin: 0; text-align: center; }
.ti-panel, .ti-card {
  width: 100%; max-width: 860px; padding: 18px; border-radius: var(--radius);
  background: var(--card); box-shadow: 0 5px 0 var(--shadow); text-align: center;
}
.ti-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.ti-stack { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.ti-scene {
  position: relative; width: 100%; max-width: 860px; flex: 1 1 auto; min-height: 320px;
  border-radius: var(--radius); overflow: hidden; background: #dff3ff; box-shadow: 0 5px 0 var(--shadow);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.ti-scene canvas { display: block; width: 100%; height: 100%; }
.ti-emoji-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 640px; font-size: clamp(2.2rem, 7vw, 3.2rem); line-height: 1; }
.ti-dots { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 5.6em; justify-content: center; }
.ti-dots i { width: 0.7em; height: 0.7em; border-radius: 50%; background: var(--c); display: block; }
.choice .ti-dots { font-size: 0.6em; }
.ti-note {
  width: 100%; max-width: 760px; margin: 0; padding: 14px 18px; border-radius: 18px;
  background: #fff4cc; border: 2px dashed #f2c94c; font-size: 1.1rem; line-height: 1.4; text-align: left;
}
.ti-note b { color: #9a6b00; }
.ti-slider { width: min(100%, 520px); accent-color: var(--c); height: 44px; }
.ti-label { font-weight: 800; color: var(--muted); font-size: 1rem; }
.ti-toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; }
.ti-help { min-height: 52px; padding: 6px 18px; font-size: 1.05rem; }

/* kepingan (ctx.place) */
.ti-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; max-width: 860px; min-height: 60px; }
.ti-chip { min-width: 72px; min-height: 72px; padding: 8px 12px; font-size: 1.05rem; touch-action: none; }
.ti-chip.is-selected { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); transform: translateY(-4px); }
.ti-chip.is-drag { z-index: 30; box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18); transition: none; }
.ti-chip.is-placed { opacity: 1; cursor: default; box-shadow: none; }
.ti-chip.is-gone { visibility: hidden; }
.ti-chip.is-collapsed { display: none; }
[data-slot] { cursor: pointer; }
[data-slot]:focus-visible { outline: 4px solid #ffb703; outline-offset: 2px; }

/* urutkan */
.ti-order { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 900px; align-items: center; }
.ti-track { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; width: 100%; }
.ti-slot {
  display: flex; align-items: center; gap: 6px; min-width: 64px; min-height: 58px; padding: 6px 12px 6px 6px;
  border: 3px dashed var(--line); border-radius: 18px; background: rgba(255, 255, 255, 0.6); font-weight: 800; font-size: 1rem;
}
.ti-track.is-long .ti-slot { min-height: 50px; font-size: 0.92rem; }
.ti-slot-n { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--line); font-size: 1rem; }
.ti-slot.is-filled { border-style: solid; border-color: var(--good); background: var(--good-bg); animation: ti-pop var(--dur-ui) var(--ease-out); }
.ti-slot.is-filled .ti-slot-n { background: var(--good); color: #fff; }
.ti-slot .ti-ic { font-size: 1.5rem; }
.ti-pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.ti-piece { flex-direction: column; gap: 4px; min-width: 132px; max-width: 220px; font-size: 1.05rem; }
.lvl-tk .ti-piece { font-size: 1.1rem; }
.ti-piece .ti-ic { font-size: 2.2rem; line-height: 1; }
.ti-piece.is-used { visibility: hidden; }

/* pilah ke keranjang */
.ti-sort { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.ti-sort-show { min-height: 180px; display: grid; place-items: center; width: 100%; }
.ti-sort-card { max-width: 300px; padding: 22px; will-change: transform; }
.ti-sort-ic { font-size: 4.2rem; line-height: 1.1; }
.ti-sort-lbl { font-size: 1.4rem; font-weight: 800; margin-top: 6px; }
.ti-bins { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: 100%; }
.ti-bin { flex-direction: column; min-width: 150px; min-height: 120px; font-size: 1.2rem; }
.ti-bin .ti-ic { font-size: 2.4rem; }
.ti-bin-count {
  position: absolute; top: -10px; right: -10px; min-width: 32px; height: 32px; padding: 0 8px; display: grid; place-items: center;
  border-radius: 999px; background: var(--c); color: #fff; font-size: 0.95rem;
}

/* ---------- hasil ---------- */
.result {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px;
  background: rgba(43, 45, 66, 0.45);
  animation: ti-fade var(--dur-modal) var(--ease-out);
}
.result-card {
  width: min(100%, 460px); padding: 26px 22px 22px; border-radius: 28px; background: var(--card); text-align: center;
  box-shadow: 0 8px 0 var(--shadow);
  animation: ti-pop var(--dur-modal) var(--ease-out);
}
.result-card h2 { margin: 8px 0 6px; font-size: 1.6rem; line-height: 1.2; }
.result-lesson { margin: 8px 0 0; padding: 12px 14px; border-radius: 16px; background: #fff4cc; text-align: left; line-height: 1.4; }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
.result-stars { display: flex; justify-content: center; gap: 6px; font-size: 4.2rem; line-height: 1; }
.rstar { color: #e6dfcf; }
.rstar.is-on {
  color: var(--sun); text-shadow: 0 3px 0 #d99a00;
  animation: ti-star 320ms var(--ease-pop) both; /* motion-ok: perayaan di akhir game, jarang terjadi */
  animation-delay: calc(120ms + var(--i) * 140ms);
}
@keyframes ti-star { from { opacity: 0; transform: scale(0.6) rotate(-20deg); } }
@keyframes ti-fade { from { opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 21; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  .progress { flex-basis: 90px; }
  .play-title { font-size: 1rem; }
  .choice { min-width: 92px; min-height: 76px; padding: 10px 14px; font-size: 1.3rem; }
  .lvl-tk .choice { min-width: 100px; min-height: 88px; font-size: 1.5rem; }
  .choice.is-big { min-width: 104px; min-height: 104px; font-size: 2.6rem; }
  .ti-piece { min-width: 46%; }
  .ti-bin { min-width: 44%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-property: opacity, background-color, color, border-color !important;
    animation-duration: 0.2s !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .pop-in, .ti-slot.is-filled, .result-card, .rstar.is-on, .tan-done,
  .ti-toast, .xp-chip, .level-up, .challenge-done, .level-ajak { animation-name: ti-fade !important; animation-delay: 0s !important; }
  .choice.is-wrong, .choice.is-correct, .choice.is-hint { animation: none !important; }
}

/* ---------- banner promosi ---------- */
.promo-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px; padding: 12px 16px;
  border-radius: var(--radius); background: linear-gradient(120deg, #2f6fed, #9b4dde); color: #fff;
  box-shadow: 0 5px 0 #1e3f8f;
}
.promo-icon { font-size: 2.2rem; line-height: 1; }
.promo-body { display: grid; gap: 1px; flex: 1 1 220px; min-width: 0; }
.promo-body b { font-size: 1.1rem; }
.promo-txt { font-size: 0.92rem; opacity: 0.92; }
.promo-go { min-height: 48px; padding: 6px 20px; font-size: 1rem; background: #ffc93c; color: #2b2d42; box-shadow: 0 5px 0 #b78a00; }
.promo-x { border: 0; background: rgba(255, 255, 255, 0.2); color: #fff; width: 44px; height: 44px; border-radius: 14px; font-size: 1.1rem; cursor: pointer; transition: transform var(--dur-press) var(--ease-out); }
.promo-x:active { transform: scale(0.92); }

/* ---------- banner pasang PWA ---------- */
.pwa-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; padding: 10px 14px; border-radius: var(--radius); background: #e8f0fe; border: 2px solid #2f6fed; }
.pwa-banner[hidden] { display: none; }
.pwa-txt { flex: 1 1 220px; min-width: 0; font-weight: 700; font-size: 0.95rem; }
.pwa-go { min-height: 44px; padding: 4px 18px; font-size: 0.95rem; }
.duta-prog { font-size: 0.85rem; color: var(--muted); font-weight: 800; }
.pwa-manual { font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.pwa-manual[hidden], .pwa-go[hidden], .ortu-pasang [hidden] { display: none; }
.ortu-pasang { display: contents; }

/* ---------- banner tantangan teman ---------- */
.tantang-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 12px 16px;
  border-radius: var(--radius); background: #ffe9e9; border: 2px solid #ff6b6b;
}
.tantang-txt { flex: 1 1 260px; min-width: 0; font-weight: 700; }
.duel-ulang { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; padding: 12px 16px; border-radius: var(--radius); background: #f3e8ff; border: 2px solid #9b4dde; }
.tantang-go { min-height: 48px; padding: 6px 20px; font-size: 1rem; }

/* ---------- footer ---------- */
.foot-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.foot-link { border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 0.9rem; text-decoration: underline; cursor: pointer; padding: 6px; }

/* ---------- statistik ---------- */
.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); margin-bottom: 6px; }
.stat-card { display: grid; gap: 2px; justify-items: center; padding: 12px 8px; border-radius: 18px; background: var(--card); box-shadow: 0 3px 0 var(--shadow); }
.stat-card b { font-size: 1.5rem; }
.stat-card span { color: var(--muted); font-size: 0.82rem; font-weight: 700; text-align: center; }
.stat-h { margin: 18px 2px 8px; font-size: 1.1rem; }
.stat-week { display: flex; gap: 6px; }
.stat-day { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--card); box-shadow: 0 3px 0 var(--shadow); color: var(--muted); font-weight: 800; font-size: 0.85rem; }
.stat-day.is-on { background: var(--good-bg); color: var(--good); }
.stat-top { margin: 0; padding-left: 24px; display: grid; gap: 4px; font-weight: 700; }
.stat-pekan { margin: 0; font-size: 0.95rem; }
.stat-kelas { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-hero { display: grid; gap: 2px; justify-items: center; padding: 18px 12px; border-radius: 22px; background: var(--card); box-shadow: 0 5px 0 var(--shadow); text-align: center; }
.stat-besar { font-size: 2.4rem; }
.stat-herosub { color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.stat-bars { display: grid; gap: 8px; margin: 12px 0 4px; }
.stat-barow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.stat-barlabel { font-weight: 800; font-size: 0.95rem; }
.stat-barnum { font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.stat-track { grid-column: 1 / -1; height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; }
.stat-fill { display: block; height: 100%; border-radius: 999px; }

/* ---------- halaman kelas ---------- */
.kelas-hero { display: grid; gap: 12px; justify-items: center; text-align: center; max-width: 640px; padding: 24px 20px; border-radius: var(--radius); background: var(--card); box-shadow: 0 5px 0 var(--shadow); }
.kelas-icon { font-size: 3.5rem; line-height: 1; }
.kelas-lead { margin: 0; font-size: 1.15rem; line-height: 1.5; }
.kelas-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; font-size: 1.05rem; }
.kelas-cta { margin-top: 6px; }
.kelas-note { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- pojok orang tua ---------- */
.ortu-hero { display: grid; gap: 12px; justify-items: center; text-align: center; max-width: 640px; padding: 24px 20px; border-radius: var(--radius); background: var(--card); box-shadow: 0 5px 0 var(--shadow); }
.ortu-icon { font-size: 3.5rem; line-height: 1; }
.ortu-lead { margin: 0; font-size: 1.15rem; line-height: 1.5; }
.ortu-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; font-size: 1.05rem; }
.ortu-cta { margin-top: 6px; }
.ortu-note { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- kunci orang tua ---------- */
.gate-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(43, 45, 66, 0.55); }
.gate-card { display: grid; justify-items: center; gap: 12px; width: min(100%, 420px); padding: 22px 20px; border-radius: var(--radius); background: var(--card); box-shadow: 0 8px 0 var(--shadow); text-align: center; }
.gate-judul { font-size: 1.25rem; }
.gate-teks { margin: 0; color: var(--muted); font-weight: 700; }
.gate-tahan { position: relative; overflow: hidden; width: 100%; min-height: 64px; border: 0; border-radius: var(--radius); background: var(--good); color: #fff; font: inherit; font-weight: 800; font-size: 1.1rem; cursor: pointer; touch-action: none; user-select: none; }
.gate-tahan span { position: relative; }
.gate-isi { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.35); transform: scaleX(0); transform-origin: left; transition: transform linear; }
.gate-isi.is-jalan { transform: scaleX(1); }

/* Waitlist kelas (orang tua). Gerak: ease-out singkat, tanpa skala dari nol. */
.kelas-wl { width: 100%; max-width: 420px; }
.wl-form { display: grid; gap: 10px; text-align: left; animation: wl-in 200ms cubic-bezier(0.23, 1, 0.32, 1); }
.wl-label { display: grid; gap: 4px; font-weight: 700; }
.wl-input { font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--shadow); background: #fff; min-height: 44px; }
.wl-input:focus-visible { outline: 3px solid #2f6fed; outline-offset: 1px; }
.wl-check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.9rem; line-height: 1.4; }
.wl-check input { margin-top: 3px; min-width: 20px; min-height: 20px; }
.wl-err { margin: 0; min-height: 1.2em; color: #b42318; font-size: 0.9rem; }
.wl-ok { margin: 0; padding: 14px; border-radius: 12px; background: #e6f6ee; font-weight: 700; }
@keyframes wl-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wl-form { animation: none; } }
