/* Petualangan Dunia Angka — gaya kartun 2D ceria.
   Layout: satu kolom tengah (maks 1100px), HUD melayang di atas, layar berganti di bawahnya.
   Tampilan sengaja satu tema (terang) agar warna dunia konsisten. */
:root {
  --ink: #2b2a4c;
  --ink-soft: #5d5b82;
  --paper: #ffffff;
  --paper-2: #f3f1ff;
  --line: #d9d5f2;
  --sky-1: #bfe8ff;
  --sky-2: #e9f8ff;
  --leaf: #2fb877;   --leaf-d: #1b8a56;
  --ocean: #2f9bff;  --ocean-d: #1b6fc9;
  --berry: #ff5c8a;  --berry-d: #c23468;
  --sun: #ffc933;    --sun-d: #d99a00;
  --grape: #7c5cff;  --grape-d: #5638d6;
  --good: #1b8a56;   --bad: #c2410c;
  --font-display: 'Baloo 2', 'Trebuchet MS', 'Comic Sans MS', system-ui, sans-serif;
  --font-body: 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  --radius: 24px;
  --w-top: #bfe8ff; --w-bot: #e6f9d8;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: #dff3ff; color: var(--ink);
  font-family: var(--font-body); font-size: 18px; line-height: 1.4;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
body[data-world="1"] { --w-top: #bdeeb0; --w-bot: #f1ffd2; }
body[data-world="2"] { --w-top: #a9e6ff; --w-bot: #fff1b8; }
body[data-world="3"] { --w-top: #cfdcff; --w-bot: #f0f4ff; }
body[data-world="4"] { --w-top: #2a2468; --w-bot: #5a3aa0; }
body[data-world="5"] { --w-top: #ffd2ec; --w-bot: #efe0ff; }
body.themed { background: linear-gradient(180deg, var(--w-top), var(--w-bot)) fixed; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; text-wrap: balance; }
button { font-family: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 4px solid var(--grape); outline-offset: 3px; border-radius: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 1100px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 12px; padding-block: 10px 28px; }
#screen { flex: 1; min-width: 0; }

/* ---------- HUD ---------- */
#hud { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: rgba(255,255,255,.92); border-radius: 28px; padding: 8px 10px; box-shadow: 0 4px 0 rgba(43,42,76,.12); position: sticky; top: 6px; z-index: 20; }
#hud .grow { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--paper-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 9px; box-shadow: 0 3px 0 var(--line); flex: none; }
.iconbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.iconbtn[aria-pressed="false"] { color: #8d8aae; background: #ebe9f5; }
.iconbtn svg { width: 100%; height: 100%; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #fff7d6; border-radius: 999px; padding: 4px 12px 4px 6px; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; box-shadow: inset 0 0 0 2px #ffe08a; font-variant-numeric: tabular-nums; }
.pill svg { width: 28px; height: 28px; }

/* ---------- Tombol ---------- */
.btn { --c: var(--leaf); --cd: var(--leaf-d); display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; padding: 10px 24px; border: 0; border-radius: 22px; background: var(--c); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: .02em; cursor: pointer; box-shadow: 0 6px 0 var(--cd); transition: transform .08s, box-shadow .08s; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--cd); }
.btn svg { width: 28px; height: 28px; flex: none; }
.btn-blue { --c: var(--ocean); --cd: var(--ocean-d); }
.btn-pink { --c: var(--berry); --cd: var(--berry-d); }
.btn-sun { --c: var(--sun); --cd: var(--sun-d); color: var(--ink); text-shadow: none; }
.btn-grape { --c: var(--grape); --cd: var(--grape-d); }
.btn-ghost { --c: #fff; --cd: var(--line); color: var(--ink); text-shadow: none; box-shadow: 0 6px 0 var(--cd), inset 0 0 0 3px var(--line); }
.btn-lg { min-height: 74px; font-size: 1.55rem; border-radius: 28px; }
.btn-sm { min-height: 46px; font-size: 1rem; padding: 6px 16px; border-radius: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.5); }

/* ---------- Beranda ---------- */
.home { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; background: linear-gradient(180deg, #8fd8ff 0%, #d8f4ff 55%, #bdeea6 55%, #8fdc84 100%); border-radius: 36px; padding: 26px; overflow: hidden; min-height: 520px; box-shadow: 0 8px 0 rgba(43,42,76,.14); }
.home .sun { position: absolute; right: 26px; top: 20px; width: 80px; animation: slowspin 40s linear infinite; }
.home .cloud { position: absolute; width: 120px; opacity: .95; animation: drift 38s linear infinite; }
.home .decor { position: absolute; bottom: 8px; width: 74px; z-index: 1; }
.hero { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.logo { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 6vw, 3.6rem); color: #fff; text-shadow: 0 4px 0 var(--grape-d), 0 8px 0 rgba(43,42,76,.2); -webkit-text-stroke: 2px var(--grape-d); paint-order: stroke fill; line-height: .95; }
.slogan { font-weight: 800; color: var(--ink); background: rgba(255,255,255,.85); padding: 6px 16px; border-radius: 999px; font-size: 1.05rem; }
.mascot { width: min(240px, 52vw); animation: bob 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.mascot .eyes, .avatar .eyes { animation: blink 5s infinite; transform-origin: 60px 62px; }
.greeting { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.menu { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 14px; }
.menu-row { display: flex; gap: 10px; flex-wrap: wrap; }
.menu-row .btn { flex: 1 1 140px; }
.note { font-size: .92rem; color: var(--ink-soft); background: rgba(255,255,255,.8); border-radius: 14px; padding: 8px 12px; }

/* ---------- Layar umum ---------- */
.panel { background: var(--paper); border-radius: 30px; padding: 20px; box-shadow: 0 6px 0 rgba(43,42,76,.12); }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.title-row h2 { font-size: 1.8rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 48px; padding: 6px 16px; border-radius: 16px; border: 3px solid var(--line); background: #fff; font-weight: 800; font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"], .chip.on { background: var(--grape); border-color: var(--grape-d); color: #fff; }
.chip[aria-disabled="true"] { opacity: .55; }
.chip svg { width: 22px; height: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.card { background: var(--paper-2); border-radius: 22px; padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; border: 3px solid transparent; min-width: 0; }
.card.locked { opacity: .7; }
.card.locked .art { filter: grayscale(1) brightness(.85); }
.card .art { width: 84px; height: 84px; }
.card .art svg { width: 100%; height: 100%; }
.card h3 { font-size: 1.1rem; }
.card small { color: var(--ink-soft); font-size: .88rem; }
.card.equipped { border-color: var(--leaf); background: #e6fbef; }
.mode-card { cursor: pointer; font: inherit; border: 3px solid transparent; }
.mode-card:hover { border-color: var(--grape); }
.mode-card .art { width: 96px; height: 96px; }

/* ---------- Peta ---------- */
.world-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; }
.world-tab { flex: 1 0 auto; min-width: 110px; min-height: 64px; border-radius: 20px; border: 3px solid var(--line); background: #fff; font-weight: 800; padding: 6px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .92rem; line-height: 1.1; }
.world-tab[aria-selected="true"] { background: var(--ocean); border-color: var(--ocean-d); color: #fff; }
.world-tab.locked { color: var(--ink-soft); background: #ecebf5; }
.world-tab small { font-size: .8rem; opacity: .9; }
.map-stage { position: relative; width: 100%; aspect-ratio: 800 / 460; max-width: 100%; border-radius: 30px; overflow: hidden; box-shadow: 0 6px 0 rgba(43,42,76,.15); background: linear-gradient(180deg, var(--w-top), var(--w-bot)); }
.map-stage > svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-stage.locked > svg.bg { filter: grayscale(.9) brightness(.9); }
.node { position: absolute; transform: translate(-50%, -50%); width: clamp(48px, 9.5%, 76px); aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--sun); color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: clamp(1.1rem, 3.2vw, 1.7rem); cursor: pointer; box-shadow: 0 6px 0 var(--sun-d), 0 0 0 4px #fff; display: grid; place-items: center; padding: 0; }
.node.open { animation: pulse 2.4s ease-in-out infinite; }
.node.done { background: var(--leaf); color: #fff; box-shadow: 0 6px 0 var(--leaf-d), 0 0 0 4px #fff; }
.node.locked { background: #b9b6d2; color: #fff; box-shadow: 0 6px 0 #8c89aa, 0 0 0 4px #fff; }
.node svg.lk { width: 55%; }
.node .nstars { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); display: flex; gap: 0; }
.node .nstars svg { width: clamp(14px, 3vw, 22px); }
.node .you { position: absolute; top: -118%; left: 50%; width: 120%; transform: translateX(-50%); animation: hop 1.1s ease-in-out infinite; pointer-events: none; }
.map-msg { margin-top: 12px; }

/* ---------- Modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(43,42,76,.55); display: grid; place-items: center; padding: 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 30px; padding: 22px; width: min(100%, 520px); box-shadow: 0 10px 0 rgba(43,42,76,.2); display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow-y: auto; animation: pop .25s ease-out; }
.modal h2 { font-size: 1.7rem; }
.modal .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal .actions .btn { flex: 1 1 140px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.field input[type="text"] { font: inherit; font-size: 1.3rem; padding: 12px 14px; border-radius: 16px; border: 3px solid var(--line); }
.field input[type="range"] { width: 100%; height: 36px; accent-color: var(--grape); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.toasts { position: fixed; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 800; display: flex; gap: 10px; align-items: center; animation: pop .25s ease-out; max-width: 100%; }
.toast svg { width: 28px; height: 28px; flex: none; }

/* ---------- Permainan ---------- */
.game { display: flex; flex-direction: column; gap: 12px; }
.game-bar { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 22px; padding: 8px 10px; }
.game-bar .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.game-bar b { font-family: var(--font-display); font-size: 1.1rem; }
.progressbar { height: 14px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.progressbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--leaf), #7be0a8); border-radius: 999px; transition: width .5s; }
.game-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.game-main.single { grid-template-columns: minmax(0, 1fr); }
.scene { position: relative; border-radius: 28px; overflow: hidden; min-height: 280px; box-shadow: 0 6px 0 rgba(43,42,76,.15); background: linear-gradient(180deg, var(--w-top), var(--w-bot)); isolation: isolate; }
.qpanel { background: #fff; border-radius: 28px; padding: 16px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; box-shadow: 0 6px 0 rgba(43,42,76,.12); min-width: 0; }
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.qhead .tag { font-weight: 800; background: var(--paper-2); border-radius: 999px; padding: 4px 14px; }
.qtext { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.15rem, 3vw, 1.45rem); text-align: center; text-wrap: balance; }
.equation { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 7vw, 3.4rem); text-align: center; line-height: 1.1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; color: var(--grape-d); }
.equation.small { font-size: clamp(1.4rem, 4.5vw, 2rem); }
.visual { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; background: var(--paper-2); border-radius: 22px; padding: 12px; min-width: 0; }
.visual.hintv { background: #fff8d8; box-shadow: inset 0 0 0 3px #ffe08a; }
.vgroup { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 100%; }
.vop { font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; color: var(--ink-soft); }
.vitem { width: var(--is, 40px); height: var(--is, 40px); position: relative; display: block; }
.vitem svg { width: 100%; height: 100%; }
.vitem.gone { opacity: .45; }
.vitem.gone::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 4px; background: var(--bad); border-radius: 4px; transform: rotate(-35deg); }
.vitem .num { position: absolute; bottom: -4px; right: -2px; background: var(--grape); color: #fff; font-size: .7rem; font-weight: 800; border-radius: 999px; min-width: 20px; text-align: center; padding: 0 4px; }
.plate { display: flex; flex-direction: column; align-items: center; background: #eaf5ff; border-radius: 50% / 38%; padding: 8px 12px 10px; box-shadow: inset 0 -4px 0 #bcd8ef; }
.plate .vgroup { max-width: 150px; }
.varray { display: grid; gap: 3px; }
.kidbox { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fff; border-radius: 18px; padding: 6px; min-width: 64px; }
.kidbox .kid { width: 46px; }
.pile { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; max-width: 100%; padding: 6px; background: #fff; border-radius: 18px; }
.choices { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { position: relative; min-height: 76px; border-radius: 24px; border: 0; background: var(--ocean); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 6vw, 2.6rem); box-shadow: 0 7px 0 var(--ocean-d); cursor: pointer; font-variant-numeric: tabular-nums; transition: transform .08s, box-shadow .08s; padding: 4px 8px; }
.choice:nth-child(2) { background: var(--berry); box-shadow: 0 7px 0 var(--berry-d); }
.choice:nth-child(3) { background: var(--leaf); box-shadow: 0 7px 0 var(--leaf-d); }
.choice:nth-child(4) { background: var(--grape); box-shadow: 0 7px 0 var(--grape-d); }
.choice:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.choice .mark { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; }
.choice.correct { background: #1fa463 !important; box-shadow: 0 7px 0 #146c42 !important; animation: pop .35s ease-out; outline: 5px solid #bff3d6; }
.choice.wrong { background: #b9b6d2 !important; box-shadow: 0 7px 0 #8c89aa !important; text-decoration: line-through; text-decoration-thickness: 4px; animation: wobble .4s; }
.choice:disabled:not(.correct):not(.wrong) { opacity: .75; cursor: default; }
.feedback { min-height: 3.2em; text-align: center; font-weight: 800; font-size: 1.15rem; border-radius: 18px; padding: 8px 12px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.feedback.good { background: #dcf8e8; color: #0d5c37; }
.feedback.bad { background: #fff0d9; color: #8a3a05; }
.feedback .ic { width: 30px; height: 30px; flex: none; }
.hint { background: #fff8d8; border-radius: 18px; padding: 10px 14px; font-weight: 700; display: flex; gap: 10px; align-items: flex-start; }
.hint svg { width: 28px; height: 28px; flex: none; }
.qactions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.qactions .btn { flex: 1 1 160px; }

/* ----- Misi Si Monyet ----- */
.scene-monyet { background: linear-gradient(180deg, #a9e8ff 0%, #d9f5ff 48%, #7fd37a 48%, #59b95f 100%); }
.scene-monyet .tree { position: absolute; right: 2%; bottom: 20%; width: 34%; }
.scene-monyet .cloudy { position: absolute; top: 8%; width: 90px; animation: drift 40s linear infinite; }
.scene-monyet .track { position: absolute; left: 0; right: 0; bottom: 4%; height: 40%; }
.scene-monyet .hero-m { position: absolute; bottom: 6%; left: 4%; width: 26%; max-width: 130px; transition: left .9s ease-in-out; transform-origin: 50% 100%; }
.hero-m.walk { animation: walk .3s ease-in-out 3; }
.hero-m.jump { animation: jump .8s ease-out; }
.hero-m.party { animation: jump .6s ease-out 3; }
.hero-m.hmm { animation: tilt .8s ease-in-out; }
.basket { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.92); border-radius: 18px; padding: 6px 12px; display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; z-index: 2; }
.basket svg { width: 34px; height: 34px; }
.basket.bump { animation: pop .35s; }
.floaty { position: absolute; width: 44px; z-index: 3; animation: floatup 1.3s ease-out forwards; pointer-events: none; }
.bubble { position: absolute; background: #fff; border-radius: 18px; padding: 6px 12px; font-weight: 800; z-index: 3; box-shadow: 0 3px 0 rgba(0,0,0,.12); max-width: 70%; }
.bubble::after { content: ""; position: absolute; bottom: -9px; left: 22px; border: 9px solid transparent; border-top-color: #fff; border-bottom: 0; }

/* ----- Roket ----- */
.scene-roket { background: linear-gradient(180deg, #1c1a56, #3f2a8a 70%, #6b3fa8); color: #fff; min-height: 340px; }
.scene-roket .star-bg { position: absolute; inset: 0; }
.scene-roket .star-bg i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; opacity: .8; animation: twinkle 4s ease-in-out infinite; }
.scene-roket .planet-t { position: absolute; top: 14px; right: 14px; width: 84px; text-align: center; font-weight: 800; font-size: .85rem; }
.scene-roket .planet-t svg { width: 84px; transition: transform 1s; }
.scene-roket .rocket { position: absolute; left: 50%; bottom: 8%; width: 96px; margin-left: -48px; transition: bottom 2.2s cubic-bezier(.5, 0, .9, .6), opacity .3s; }
.scene-roket .rocket.shake { animation: wobble .5s; }
.scene-roket .rocket .flame { transform-origin: 32px 46px; animation: flame .5s ease-in-out infinite alternate; }
.scene-roket .fuel { position: absolute; left: 14px; bottom: 14px; top: 14px; width: 40px; background: rgba(255,255,255,.18); border-radius: 18px; padding: 5px; display: flex; flex-direction: column-reverse; gap: 5px; }
.scene-roket .fuel i { flex: 1; border-radius: 10px; background: rgba(255,255,255,.14); transition: background .4s; }
.scene-roket .fuel i.on { background: linear-gradient(180deg, #ffdd57, #ff9a3c); }
.scene-roket .label { position: absolute; left: 66px; top: 14px; font-weight: 800; background: rgba(0,0,0,.28); padding: 4px 12px; border-radius: 999px; }
.scene-roket .arrive { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; text-shadow: 0 3px 0 rgba(0,0,0,.4); animation: pop .4s; z-index: 4; }

/* ----- Toko Kue ----- */
.scene-toko { background: linear-gradient(180deg, #ffe6f2 0%, #fff4e0 100%); min-height: 320px; }
.scene-toko .awning { position: absolute; top: 0; left: 0; right: 0; height: 54px; background: repeating-linear-gradient(90deg, #ff6b9a 0 34px, #fff 34px 68px); border-radius: 0 0 26px 26px; box-shadow: 0 5px 0 rgba(0,0,0,.12); }
.scene-toko .counter { position: absolute; left: 0; right: 0; bottom: 0; height: 36%; background: #c68a4f; border-top: 8px solid #e6b57a; }
.scene-toko .shelf { position: absolute; right: 12px; bottom: 33%; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 55%; }
.scene-toko .shelf .vitem { --is: 34px; }
.scene-toko .customer { position: absolute; left: 6%; bottom: 30%; width: 28%; max-width: 130px; transition: transform .6s ease-out, opacity .4s; }
.scene-toko .customer.enter { animation: slidein .6s ease-out; }
.scene-toko .customer.happy { animation: jump .7s ease-out; }
.scene-toko .served { position: absolute; width: 50px; bottom: 36%; left: 60%; z-index: 3; }
.scene-toko .served.go { animation: serve .8s ease-in forwards; }
.scene-toko .bubble { top: 62px; left: 4%; }

/* ----- Peti ----- */
.scene-peti { background: linear-gradient(180deg, #a8e6ff 0%, #d6f4ff 50%, #ffe9a8 50%, #ffd36f 100%); min-height: 320px; }
.scene-peti .chestwrap { position: absolute; left: 50%; bottom: 14%; width: 46%; max-width: 190px; transform: translateX(-50%); }
.scene-peti .chestwrap.shake { animation: wobble .5s; }
.scene-peti .lid { transform-origin: 8px 33px; transition: transform .9s ease-out; }
.scene-peti .chestwrap.open .lid { transform: rotate(-70deg); }
.scene-peti .chestwrap .glow { position: absolute; inset: -20% -20% 30%; border-radius: 50%; background: radial-gradient(circle, rgba(255,230,120,.9), transparent 65%); opacity: 0; transition: opacity 1s; }
.scene-peti .chestwrap.open .glow { opacity: 1; }
.scene-peti .keys { position: absolute; top: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 0 10px; }
.scene-peti .keys svg { width: 42px; height: 42px; }
.scene-peti .keys svg.got { animation: pop .4s; }
.burst { position: absolute; width: 38px; z-index: 5; animation: burst 1.4s ease-out forwards; pointer-events: none; }

/* ----- Latihan ----- */
.scene-latihan { background: linear-gradient(180deg, var(--w-top), #fff); min-height: 220px; display: grid; place-items: center; padding: 14px; text-align: center; gap: 6px; }
.scene-latihan .avatar { width: 120px; animation: bob 3.2s ease-in-out infinite; }

/* ----- Ular Tangga ----- */
.sl-wrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.board-box { background: #fff; border-radius: 28px; padding: 10px; box-shadow: 0 6px 0 rgba(43,42,76,.15); }
.board { position: relative; width: 100%; aspect-ratio: 6 / 5; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(5, 1fr); gap: 3px; }
.cell { border-radius: 12px; position: relative; display: grid; place-items: center; min-width: 0; font-weight: 800; font-size: clamp(.7rem, 2.2vw, 1rem); color: var(--ink); }
.cell .n { position: absolute; top: 2px; left: 5px; font-size: clamp(.62rem, 1.9vw, .9rem); opacity: .85; }
.cell svg { width: 46%; max-width: 40px; }
.cell.c0 { background: #ffe58f; } .cell.c1 { background: #bff0cf; } .cell.c2 { background: #bde3ff; } .cell.c3 { background: #ffd0e0; }
.cell.sp { box-shadow: inset 0 0 0 3px var(--grape); }
.cell.finish { background: linear-gradient(135deg, #ffc933, #ff9a3c); box-shadow: inset 0 0 0 3px #fff; }
.board svg.over { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.token { position: absolute; width: 11%; transform: translate(-50%, -62%); transition: left .28s ease-in-out, top .28s ease-in-out; z-index: 4; filter: drop-shadow(0 3px 0 rgba(0,0,0,.2)); pointer-events: none; }
.token .tag { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 999px; font-size: .62rem; padding: 0 6px; font-weight: 800; white-space: nowrap; }
.token.p2 { filter: drop-shadow(0 3px 0 rgba(0,0,0,.2)) hue-rotate(80deg); }
.token.climb { transition-duration: .9s; }
.sl-panel { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: #fff; border-radius: 24px; padding: 10px 14px; }
.sl-panel .who { flex: 1 1 160px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; min-width: 0; }
.dice { width: 84px; height: 84px; background: #fff; border-radius: 20px; box-shadow: 0 6px 0 #b9b6d2, inset 0 0 0 4px var(--ink); display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 12px; gap: 2px; flex: none; }
.dice i { border-radius: 50%; }
.dice i.on { background: var(--ink); }
.dice.rolling { animation: roll .7s ease-in-out; }
.log { background: #fff; border-radius: 18px; padding: 8px 12px; font-weight: 700; min-height: 2.6em; }

/* ----- Hasil ----- */
.result { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; background: #fff; border-radius: 34px; padding: 26px 18px; box-shadow: 0 8px 0 rgba(43,42,76,.14); position: relative; overflow: hidden; }
.result h2 { font-size: clamp(2rem, 6vw, 3rem); color: var(--grape-d); }
.stars-row { display: flex; gap: 10px; justify-content: center; }
.stars-row svg { width: clamp(64px, 18vw, 110px); }
.stars-row svg.pop { animation: starin .7s ease-out both; }
.stat-line { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stat { background: var(--paper-2); border-radius: 18px; padding: 8px 16px; font-weight: 800; display: flex; gap: 8px; align-items: center; }
.stat svg { width: 28px; height: 28px; }
.rewards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.confetti { position: absolute; top: -20px; width: 14px; height: 14px; border-radius: 4px; animation: fall 3.2s ease-in forwards; pointer-events: none; }

/* ----- Progres ----- */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.big { background: var(--paper-2); border-radius: 22px; padding: 12px; text-align: center; }
.big b { display: block; font-family: var(--font-display); font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.oprow { display: grid; grid-template-columns: minmax(110px, 1.2fr) 3fr minmax(110px, 1.3fr); gap: 10px; align-items: center; padding: 10px 0; border-bottom: 2px dashed var(--line); }
.meter { height: 18px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--leaf); border-radius: 999px; }
.badge { display: inline-flex; gap: 6px; align-items: center; font-weight: 800; font-size: .9rem; padding: 3px 10px; border-radius: 999px; background: var(--paper-2); }
.badge.ok { background: #dcf8e8; color: #0d5c37; } .badge.warn { background: #fff0d9; color: #8a3a05; } .badge.new { background: #e8e3ff; color: var(--grape-d); }
.legend-note { margin-top: 14px; font-size: .95rem; color: var(--ink-soft); }

/* ---------- Animasi ---------- */
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1) } 95% { transform: scaleY(.1) } }
@keyframes drift { from { transform: translateX(-160px) } to { transform: translateX(120vw) } }
@keyframes slowspin { to { transform: rotate(360deg) } }
@keyframes pulse { 0%, 100% { transform: translate(-50%, -50%) scale(1) } 50% { transform: translate(-50%, -50%) scale(1.08) } }
@keyframes hop { 0%, 100% { transform: translateX(-50%) translateY(0) } 50% { transform: translateX(-50%) translateY(-10px) } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0 } 70% { transform: scale(1.06) } 100% { transform: scale(1); opacity: 1 } }
@keyframes wobble { 0%, 100% { transform: rotate(0) } 25% { transform: rotate(-4deg) } 75% { transform: rotate(4deg) } }
@keyframes tilt { 0%, 100% { transform: rotate(0) } 40% { transform: rotate(-9deg) } 70% { transform: rotate(6deg) } }
@keyframes walk { 0%, 100% { transform: translateY(0) rotate(0) } 50% { transform: translateY(-8px) rotate(3deg) } }
@keyframes jump { 0% { transform: translateY(0) scale(1, 1) } 20% { transform: translateY(0) scale(1.08, .9) } 55% { transform: translateY(-60px) scale(.95, 1.08) } 100% { transform: translateY(0) scale(1, 1) } }
@keyframes floatup { 0% { transform: translateY(0) scale(.6); opacity: 0 } 20% { opacity: 1 } 100% { transform: translateY(-90px) scale(1); opacity: 0 } }
@keyframes twinkle { 0%, 100% { opacity: .25 } 50% { opacity: .95 } }
@keyframes flame { from { transform: scaleY(.8) } to { transform: scaleY(1.25) } }
@keyframes slidein { from { transform: translateX(120%); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes serve { 0% { transform: translate(0, 0) } 100% { transform: translate(-260%, -20%) scale(.8); opacity: .2 } }
@keyframes burst { 0% { transform: translate(0, 0) scale(.4); opacity: 0 } 15% { opacity: 1 } 100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot)); opacity: 0 } }
@keyframes roll { 0% { transform: rotate(0) } 50% { transform: rotate(200deg) scale(.92) } 100% { transform: rotate(360deg) } }
@keyframes starin { 0% { transform: scale(0) rotate(-40deg); opacity: 0 } 70% { transform: scale(1.15) rotate(6deg); opacity: 1 } 100% { transform: scale(1) rotate(0) } }
@keyframes fall { to { transform: translateY(520px) rotate(540deg); opacity: .2 } }
@keyframes spin { 0%, 100% { transform: scaleX(1) } 50% { transform: scaleX(.25) } }
.spin { animation: spin 2.4s ease-in-out infinite; }

/* ---------- Responsif ---------- */
@media (max-width: 820px) {
  .home { grid-template-columns: 1fr; padding: 18px; min-height: 0; }
  .game-main { grid-template-columns: minmax(0, 1fr); }
  .scene { min-height: 230px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .btn-lg { min-height: 64px; font-size: 1.3rem; }
  .oprow { grid-template-columns: 1fr; gap: 4px; }
  .choice { min-height: 68px; }
  .panel { padding: 14px; }
  #hud .grow { flex-basis: 100%; order: 5; font-size: 1rem; }
  .iconbtn { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
