/* ============ DUNIA CILIK — gaya utama ============ */
:root {
  --bg: #fff6e5;
  --bg2: #e8f7ff;
  --ink: #3d3256;
  --ink-soft: #7a6f93;
  --card: #ffffff;
  --pink: #ff8fab;
  --red: #ff6b6b;
  --orange: #ff9f43;
  --yellow: #feca57;
  --green: #4cd18a;
  --teal: #1dd1a1;
  --blue: #54a0ff;
  --sky: #48dbfb;
  --purple: #a77bff;
  --brown: #b97a56;
  --shadow: 0 6px 0 rgba(61, 50, 86, .14), 0 10px 24px rgba(61, 50, 86, .10);
  --shadow-sm: 0 4px 0 rgba(61, 50, 86, .14);
  --radius: 26px;
  --tap: 64px;
  --font: "Baloo 2", "Nunito", "Comic Sans MS", "Chalkboard SE", "Segoe UI Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 10% 10%, #ffe2ec 0 80px, transparent 81px),
    radial-gradient(circle at 92% 18%, #dff3ff 0 110px, transparent 111px),
    radial-gradient(circle at 80% 92%, #e5ffe9 0 120px, transparent 121px),
    linear-gradient(180deg, #fff6e5, #fef0f6);
  background-attachment: fixed;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
input, textarea, select { user-select: text; -webkit-user-select: text; font-family: inherit; }
button { font-family: inherit; color: inherit; }
#app { min-height: 100%; display: flex; flex-direction: column; }

.boot { flex: 1; display: grid; place-items: center; align-content: center; gap: 8px; }
.boot-logo { font-size: 80px; font-family: var(--emoji); animation: bounce 1s infinite; }
.boot-text { font-size: 34px; font-weight: 900; }

.emo { font-family: var(--emoji); line-height: 1; }

/* ---------- screen + top bar ---------- */
.screen {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn .25s ease;
}
.topbar { display: flex; align-items: center; gap: 10px; min-height: 64px; }
.topbar .title { flex: 1; font-size: clamp(20px, 5vw, 30px); font-weight: 900; text-align: center; line-height: 1.1; }
.topbar .spacer { width: 60px; flex: none; }

.btn-round {
  width: 60px; height: 60px; flex: none;
  border-radius: 50%; border: none;
  background: var(--card); box-shadow: var(--shadow-sm);
  font-size: 28px; display: grid; place-items: center; cursor: pointer;
  font-family: var(--emoji);
  transition: transform .1s;
}
.btn-round:active { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 rgba(61,50,86,.14); }

.btn {
  border: none; cursor: pointer;
  min-height: var(--tap); padding: 10px 26px;
  border-radius: 999px;
  font-size: 22px; font-weight: 800;
  background: var(--orange); color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.18);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .1s, box-shadow .1s;
  text-shadow: 0 2px 0 rgba(0,0,0,.12);
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn.big { font-size: 28px; min-height: 80px; padding: 12px 40px; }
.btn.green { background: var(--green); }
.btn.blue { background: var(--blue); }
.btn.purple { background: var(--purple); }
.btn.pink { background: var(--pink); }
.btn.red { background: var(--red); }
.btn.ghost { background: var(--card); color: var(--ink); text-shadow: none; box-shadow: var(--shadow-sm); }
.btn.small { min-height: 48px; font-size: 18px; padding: 6px 18px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border-radius: 999px; padding: 6px 14px;
  font-weight: 800; font-size: 20px; box-shadow: var(--shadow-sm);
}

/* ---------- home ---------- */
.home-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.player-card {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 240px;
  background: var(--card); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow);
  border: none; text-align: left; cursor: pointer;
}
.avatar {
  position: relative; width: 70px; height: 70px; flex: none;
  border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(160deg, #ffe7a8, #ffc76e);
  font-size: 44px; font-family: var(--emoji);
}
.avatar .hat { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 30px; }
.avatar .acc { position: absolute; bottom: 2px; right: -6px; font-size: 24px; }
.avatar.lg { width: 120px; height: 120px; font-size: 76px; }
.avatar.lg .hat { font-size: 50px; top: -32px; }
.avatar.lg .acc { font-size: 40px; }
.player-name { font-size: 24px; font-weight: 900; line-height: 1.1; }
.player-sub { font-size: 16px; color: var(--ink-soft); font-weight: 700; }
.lvl-bar { height: 12px; background: #f1e9ff; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.lvl-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--pink)); border-radius: 99px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }

.logo { text-align: center; margin: 4px 0 0; }
.logo h1 {
  margin: 0; font-size: clamp(40px, 10vw, 68px); font-weight: 900; letter-spacing: 1px; line-height: 1;
  background: linear-gradient(90deg, #ff6b6b, #ff9f43, #feca57, #1dd1a1, #54a0ff, #a77bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(61,50,86,.15));
}
.logo p { margin: 6px 0 0; font-size: clamp(15px, 3.6vw, 20px); font-weight: 800; color: var(--ink-soft); }

.home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile-btn {
  border: none; cursor: pointer; border-radius: var(--radius);
  padding: 14px 10px; min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 19px; font-weight: 900; color: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.16);
  text-shadow: 0 2px 0 rgba(0,0,0,.14); position: relative;
  transition: transform .1s;
}
.tile-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.16); }
.tile-btn .emo { font-size: 44px; text-shadow: none; }
.tile-btn .badge { position: absolute; top: 8px; right: 10px; background: #fff; color: var(--red); border-radius: 99px; padding: 0 9px; font-size: 15px; text-shadow: none; }

.section-title { font-size: 24px; font-weight: 900; margin: 6px 0 -4px; display: flex; align-items: center; gap: 8px; }

.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.mode-card {
  border: none; cursor: pointer; border-radius: var(--radius);
  padding: 14px 10px 12px; color: var(--ink); text-align: center;
  background: var(--card); box-shadow: var(--shadow); position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .12s;
}
.mode-card:active { transform: scale(.96); }
.mode-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 78px; background: var(--c, var(--yellow)); opacity: .28; }
.mode-card .emo { font-size: 50px; position: relative; margin-top: 4px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.08)); }
.mode-card .name { font-size: 18px; font-weight: 900; line-height: 1.1; position: relative; min-height: 40px; display: grid; place-items: center; }
.mode-card .prog { width: 100%; height: 10px; background: #f2eef8; border-radius: 99px; overflow: hidden; }
.mode-card .prog i { display: block; height: 100%; background: var(--c, var(--yellow)); }
.mode-card .meta { font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.mode-card.locked { filter: grayscale(.8); opacity: .6; }

/* ---------- character bubble ---------- */
.guide { display: flex; align-items: flex-end; gap: 10px; }
.guide .char { font-size: 56px; font-family: var(--emoji); flex: none; animation: wiggle 3s ease-in-out infinite; transform-origin: bottom center; cursor: pointer; background: none; border: none; padding: 0; }
.guide .bubble {
  position: relative; background: var(--card); border-radius: 22px; padding: 10px 16px; font-size: clamp(18px, 4.4vw, 24px); font-weight: 800;
  box-shadow: var(--shadow-sm); flex: 1; line-height: 1.2;
}
.guide .bubble::before { content: ""; position: absolute; left: -10px; bottom: 16px; border: 10px solid transparent; border-right-color: var(--card); border-left: 0; }
.guide .bubble small { display: block; font-size: 15px; color: var(--ink-soft); font-weight: 700; }

/* ---------- level map ---------- */
.tier-head { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 20px; font-weight: 900; }
.tier-head .tag { padding: 4px 14px; border-radius: 99px; color: #fff; font-size: 16px; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px; }
.lvl {
  aspect-ratio: 1; border: none; border-radius: 24px; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 900; position: relative; color: var(--ink);
}
.lvl .st { font-size: 13px; letter-spacing: -1px; font-family: var(--emoji); }
.lvl.done { background: linear-gradient(160deg, #fff5c7, #ffe08a); }
.lvl.current { background: var(--c, var(--orange)); color: #fff; animation: pulse 1.4s infinite; }
.lvl.locked { background: #ece6f3; color: #b9aecb; cursor: not-allowed; }
.lvl.special::after { content: "🎁"; position: absolute; top: -8px; right: -6px; font-size: 22px; font-family: var(--emoji); }

/* ---------- play ---------- */
.play-head { display: flex; align-items: center; gap: 10px; }
.play-head .progress { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.play-head .progress i { width: 18px; height: 18px; border-radius: 50%; background: #e7dff2; display: block; }
.play-head .progress i.ok { background: var(--green); }
.play-head .progress i.now { background: var(--orange); transform: scale(1.25); }
.stage {
  flex: 1; background: rgba(255,255,255,.7); border-radius: 32px; box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; position: relative; min-height: 360px;
  backdrop-filter: blur(4px);
}
.prompt-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; text-align: center; }
.prompt-text { font-size: clamp(22px, 5.5vw, 34px); font-weight: 900; line-height: 1.15; }
.prompt-big { font-size: clamp(80px, 22vw, 150px); line-height: 1; font-weight: 900; }
.prompt-big.letter { font-family: var(--font); color: var(--purple); text-shadow: 0 6px 0 rgba(167,123,255,.25); }
.speak-btn { background: var(--sky); color: #fff; }

.choices { display: grid; gap: 14px; justify-content: center; grid-template-columns: repeat(var(--cols, 3), minmax(0, 170px)); margin: 0 auto; width: 100%; }
.choice {
  aspect-ratio: 1; border: none; cursor: pointer; border-radius: 28px;
  background: var(--card); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: clamp(44px, 12vw, 84px); font-weight: 900; color: var(--ink); padding: 6px; position: relative;
  transition: transform .12s;
}
.choice .lbl { font-size: clamp(13px, 3vw, 17px); font-weight: 800; color: var(--ink-soft); font-family: var(--font); line-height: 1.05; }
.choice .en { font-size: 12px; color: var(--blue); font-family: var(--font); }
.choice.txt { font-size: clamp(30px, 8vw, 54px); font-family: var(--font); }
.choice.wide { aspect-ratio: auto; min-height: 84px; font-size: clamp(18px, 4.6vw, 24px); font-family: var(--font); padding: 12px; text-align: center; line-height: 1.15; }
.choice:active { transform: scale(.95); }
.choice.right { background: #d8ffe8; box-shadow: 0 0 0 6px var(--green), var(--shadow); animation: pop .45s; }
.choice.wrong { animation: shake .45s; background: #fff0f0; }
.choice.dim { opacity: .35; }
.choice.sel { box-shadow: 0 0 0 6px var(--orange), var(--shadow); }
.choice.flat { box-shadow: none; background: transparent; }

.objects { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; max-width: 640px; margin: 0 auto; }
.objects .o { font-size: clamp(34px, 9vw, 58px); font-family: var(--emoji); line-height: 1.05; border: none; background: none; padding: 2px; cursor: pointer; position: relative; }
.objects .o.counted { transform: scale(.85); opacity: .55; }
.objects .o .n { position: absolute; top: -4px; right: -4px; background: var(--orange); color: #fff; font-family: var(--font); font-size: 16px; font-weight: 900; border-radius: 99px; min-width: 24px; height: 24px; display: grid; place-items: center; }
.eq { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 46px; font-weight: 900; }
.eq .grp { display: flex; flex-wrap: wrap; max-width: 220px; justify-content: center; background: var(--card); border-radius: 20px; padding: 8px; box-shadow: var(--shadow-sm); }
.eq .grp span { font-size: 34px; font-family: var(--emoji); }
.eq .grp span.gone { opacity: .25; filter: grayscale(1); position: relative; }

.silhouette { filter: brightness(0) saturate(100%); opacity: .85; }
.blurred { filter: blur(10px); }

/* drag & drop */
.drag-src {
  touch-action: none; cursor: grab; border: none; background: var(--card); box-shadow: var(--shadow-sm);
  border-radius: 22px; min-width: 80px; min-height: 80px; padding: 6px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 50px; font-family: var(--emoji); color: var(--ink);
}
.drag-src.txt { font-family: var(--font); font-weight: 900; font-size: 42px; }
.drag-src .lbl { font-family: var(--font); font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.drag-src.placed { visibility: hidden; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) scale(1.12); filter: drop-shadow(0 12px 12px rgba(0,0,0,.25)); }
.drop-zone { border: 4px dashed #d4c8e8; border-radius: 24px; background: rgba(255,255,255,.6); transition: background .15s, border-color .15s; }
.drop-zone.hover { border-color: var(--orange); background: #fff3df; }
.drop-zone.filled { border-style: solid; border-color: var(--green); background: #e5ffef; }

.tray { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 8px; min-height: 96px; }

.match-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 24px; max-width: 620px; margin: 0 auto; width: 100%; }
.match-target .tgt { display: flex; flex-direction: column; align-items: center; min-width: 84px; }
.match-target .lbl, .drag-src .lbl { font-family: var(--font); font-size: 14px; font-weight: 800; color: var(--ink-soft); line-height: 1.1; text-align: center; }
.match-target .fhtml, .drag-src .fhtml { font-size: 16px; }
.slots .slot .lbl { display: none; }
.match-target { min-height: 90px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px; font-size: 48px; font-family: var(--emoji); }
.match-target .txt { font-family: var(--font); font-weight: 900; font-size: 44px; }
.match-target .slot { width: 84px; height: 84px; border-radius: 20px; display: grid; place-items: center; }

.bins { display: grid; grid-template-columns: repeat(var(--bins, 2), minmax(0, 1fr)); gap: 10px; }
.bin { min-height: 170px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bin .bin-head { font-size: clamp(15px, 4vw, 20px); font-weight: 900; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; line-height: 1.1; }
.bin .bin-head .emo { font-size: 38px; }
.bin .bin-items { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; font-size: 34px; font-family: var(--emoji); }

.slots { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.slots .slot { width: 92px; height: 92px; display: grid; place-items: center; font-size: 52px; font-family: var(--emoji); position: relative; }
.slots .slot .num { position: absolute; top: -12px; left: -8px; background: var(--purple); color: #fff; font-family: var(--font); font-weight: 900; font-size: 16px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.slots .slot.txt { font-family: var(--font); font-weight: 900; font-size: 46px; width: 76px; height: 86px; }
.slots .slot.given { border-style: solid; border-color: transparent; background: #f4efff; }
.seq-card { font-size: 46px; }
.seq-card .lbl { max-width: 96px; text-align: center; }

/* memory */
.mem-grid { display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 4), minmax(0, 120px)); justify-content: center; }
.mcard { aspect-ratio: 3/4; perspective: 600px; border: none; background: none; padding: 0; cursor: pointer; }
.mcard .in { position: relative; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.mcard.open .in, .mcard.done .in { transform: rotateY(180deg); }
.mcard .f, .mcard .b { position: absolute; inset: 0; border-radius: 18px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow-sm); }
.mcard .f { background: repeating-linear-gradient(45deg, #a77bff, #a77bff 10px, #b993ff 10px, #b993ff 20px); font-size: 34px; color: #fff; font-family: var(--emoji); }
.mcard .b { background: var(--card); transform: rotateY(180deg); font-size: clamp(30px, 8vw, 54px); font-family: var(--emoji); }
.mcard .b.txt { font-family: var(--font); font-weight: 900; }
.mcard.done .b { background: #dcffe9; }

/* recall grid */
.cell-grid { display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 110px)); justify-content: center; }
.cell { aspect-ratio: 1; border: none; border-radius: 22px; background: var(--card); box-shadow: var(--shadow-sm); font-size: clamp(34px, 9vw, 60px); font-family: var(--emoji); cursor: pointer; display: grid; place-items: center; }
.cell.cover { background: linear-gradient(160deg, #c8b5ff, #a77bff); }
.cell.lit { transform: scale(1.06); box-shadow: 0 0 0 6px #fff, 0 0 26px 8px currentColor; }
.simon { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 140px)); gap: 14px; justify-content: center; }
.simon button { aspect-ratio: 1; border: none; border-radius: 30px; cursor: pointer; box-shadow: var(--shadow-sm); opacity: .55; transition: opacity .12s, transform .12s; display: grid; place-items: center; }
.simon button.lit { opacity: 1; transform: scale(1.08); }

/* puzzle */
.puzzle-wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-start; }
.puzzle-board { display: grid; gap: 3px; background: #e9e0f5; padding: 3px; border-radius: 18px; position: relative; }
.puzzle-board .pslot { background: rgba(255,255,255,.55); border-radius: 6px; position: relative; overflow: hidden; }
.puzzle-board .pslot.ghost::before { content: ""; position: absolute; inset: 0; background: var(--img) no-repeat; background-size: var(--bs); background-position: var(--bp); opacity: .18; filter: grayscale(1); }
.puzzle-board .pslot.hover { outline: 4px solid var(--orange); }
.piece { border-radius: 6px; background: var(--img) no-repeat; background-size: var(--bs); background-position: var(--bp); box-shadow: 0 3px 8px rgba(0,0,0,.2); touch-action: none; cursor: grab; border: none; padding: 0; }
.ptray { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 520px; }

/* maze */
.maze-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.maze { position: relative; background: #fffdf5; border-radius: 16px; box-shadow: var(--shadow-sm); touch-action: none; }
.maze canvas { display: block; border-radius: 16px; }
.maze .tok { position: absolute; display: grid; place-items: center; font-family: var(--emoji); transition: left .14s, top .14s; pointer-events: none; }
.dpad { display: grid; grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(2, 64px); gap: 8px; }
.dpad button { border: none; border-radius: 20px; background: var(--blue); color: #fff; font-size: 30px; box-shadow: 0 5px 0 rgba(0,0,0,.18); cursor: pointer; }
.dpad button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.dpad .u { grid-column: 2; grid-row: 1; } .dpad .l { grid-column: 1; grid-row: 2; } .dpad .d { grid-column: 2; grid-row: 2; } .dpad .r { grid-column: 3; grid-row: 2; }

/* coloring + drawing */
.color-wrap { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; }
.color-art { width: min(80vw, 380px); aspect-ratio: 1; background: #fff; border-radius: 26px; box-shadow: var(--shadow-sm); padding: 8px; }
.color-art svg { width: 100%; height: 100%; }
.color-art svg [data-r] { cursor: pointer; stroke: #3d3256; stroke-width: 3; stroke-linejoin: round; transition: fill .2s; }
.color-art svg .line { fill: none; stroke: #3d3256; stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.palette { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 380px; }
.swatch { width: 54px; height: 54px; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; }
.swatch.on { transform: scale(1.18); box-shadow: 0 0 0 4px var(--ink); }
.draw-pad { position: relative; width: min(92vw, 560px); aspect-ratio: 4/3; background: #fff; border-radius: 26px; box-shadow: var(--shadow-sm); touch-action: none; overflow: hidden; }
.draw-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tools { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* hidden objects scene */
.scene { position: relative; width: min(94vw, 640px); aspect-ratio: 4/3; border-radius: 26px; overflow: hidden; box-shadow: var(--shadow-sm); margin: 0 auto; }
.scene .it { position: absolute; transform: translate(-50%, -50%); font-family: var(--emoji); border: none; background: none; padding: 0; cursor: pointer; line-height: 1; }
.scene .it.found { animation: pop .45s forwards; filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 4px #4cd18a); }
.scene .it.gone { opacity: .2; }
.targets { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.targets span { background: var(--card); border-radius: 16px; padding: 4px 10px; font-size: 30px; font-family: var(--emoji); box-shadow: var(--shadow-sm); }
.targets span.got { background: #d8ffe8; opacity: .6; }

/* spot the difference */
.diff-wrap { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.diff-pane { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 6px; padding: 10px; background: var(--card); border-radius: 22px; box-shadow: var(--shadow-sm); width: min(44vw, 300px); }
.diff-pane button { aspect-ratio: 1; border: none; background: #fbf8ff; border-radius: 12px; font-size: clamp(22px, 6vw, 42px); font-family: var(--emoji); cursor: pointer; padding: 0; }
.diff-pane button.hit { background: #d8ffe8; box-shadow: 0 0 0 4px var(--green); }

/* pattern strip */
.strip { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; }
.strip .s { width: 70px; height: 70px; display: grid; place-items: center; background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm); font-size: 44px; font-family: var(--emoji); }
.strip .s.q { background: #fff3df; border: 4px dashed var(--orange); font-family: var(--font); font-weight: 900; color: var(--orange); }
.shape-svg { width: 1em; height: 1em; display: block; }

/* dots */
.dots-pad { position: relative; width: min(90vw, 440px); aspect-ratio: 1; background: #fff; border-radius: 26px; box-shadow: var(--shadow-sm); touch-action: none; }
.dots-pad svg { width: 100%; height: 100%; }
.dots-pad .reveal { position: absolute; inset: 0; display: grid; place-items: center; font-size: 180px; font-family: var(--emoji); opacity: 0; transition: opacity .6s; pointer-events: none; }
.dots-pad.done .reveal { opacity: .95; }

/* feedback + overlays */
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 900; }
.toast {
  position: fixed; left: 50%; top: 18%; transform: translate(-50%, 0); z-index: 950;
  background: var(--card); padding: 14px 24px; border-radius: 26px; font-size: clamp(22px, 5vw, 32px); font-weight: 900;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; animation: toastIn .3s ease; pointer-events: none; text-align: center; max-width: 92vw;
}
.toast .emo { font-size: 46px; }
.toast.good { color: #189a5a; }
.toast.try { color: #d36b00; }
.confetti { position: fixed; top: -20px; font-size: 28px; font-family: var(--emoji); animation: fall linear forwards; pointer-events: none; z-index: 960; }

.modal-back { position: fixed; inset: 0; background: rgba(61,50,86,.45); display: grid; place-items: center; z-index: 980; pointer-events: auto; padding: 16px; animation: fadeIn .2s; }
.modal {
  background: var(--card); border-radius: 32px; padding: 22px; width: min(560px, 100%); max-height: 92vh; overflow: auto;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; animation: pop .35s;
}
.modal h2 { margin: 0; font-size: 32px; font-weight: 900; }
.modal p { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink-soft); }
.modal .row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.big-stars { font-size: 56px; font-family: var(--emoji); letter-spacing: 4px; }
.big-stars .off { filter: grayscale(1); opacity: .3; }
.reward-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.reward-list .pill { font-size: 18px; }

/* lists & panels */
.panel { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.grid-coll { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.coll-item { background: var(--card); border-radius: 22px; padding: 10px 6px; box-shadow: var(--shadow-sm); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; border: none; cursor: pointer; color: var(--ink); }
.coll-item .emo { font-size: 46px; }
.coll-item .lbl { font-size: 13px; font-weight: 800; line-height: 1.1; }
.coll-item.off { filter: grayscale(1); opacity: .4; }
.coll-item.on { box-shadow: 0 0 0 4px var(--green), var(--shadow-sm); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tabs button { border: none; border-radius: 99px; padding: 10px 18px; font-size: 18px; font-weight: 900; background: var(--card); box-shadow: var(--shadow-sm); cursor: pointer; }
.tabs button.on { background: var(--purple); color: #fff; }

/* daily */
.daily-list { display: grid; gap: 12px; }
.daily-item { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 24px; padding: 12px 16px; box-shadow: var(--shadow-sm); border: none; cursor: pointer; text-align: left; font-size: 20px; font-weight: 900; color: var(--ink); }
.daily-item .emo { font-size: 44px; }
.daily-item .chk { margin-left: auto; font-size: 34px; font-family: var(--emoji); }
.daily-item.done { background: #e4ffef; }

/* parent */
.parent { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; user-select: text; }
.parent .panel h3 { margin: 0 0 10px; font-size: 20px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv div { background: #f8f4ff; border-radius: 16px; padding: 10px 12px; }
.kv b { display: block; font-size: 24px; }
.kv span { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid #eee6f6; text-align: left; vertical-align: middle; }
.table th { font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .5px; }
.mbadge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.mb0 { background: #eee; color: #777; } .mb1 { background: #ffe9d1; color: #b25b00; } .mb2 { background: #fff6c2; color: #8a6d00; } .mb3 { background: #d9ffe8; color: #12804a; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-soft); height: 100%; justify-content: flex-end; }
.bars .bar i { display: block; width: 100%; max-width: 40px; background: linear-gradient(180deg, var(--purple), var(--blue)); border-radius: 8px 8px 4px 4px; min-height: 3px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%; }
.field label { font-weight: 700; font-size: 15px; }
.field input, .field select { font-size: 18px; padding: 12px 14px; border-radius: 14px; border: 2px solid #e1d8ef; background: #fff; color: var(--ink); width: 100%; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0eaf7; font-weight: 600; }
.switch { width: 62px; height: 36px; border-radius: 99px; background: #d9d1e6; border: none; position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.switch.on { background: var(--green); }
.switch.on::after { left: 30px; }
.rec-list { display: grid; gap: 8px; }
.rec-list button { text-align: left; border: none; border-radius: 14px; padding: 10px 12px; background: #fff7e8; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink); }

/* certificate */
.cert { background: #fffdf3; border: 10px double var(--orange); border-radius: 26px; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.cert h2 { margin: 0; font-size: 34px; color: var(--orange); }
.cert .who { font-size: 40px; font-weight: 900; color: var(--purple); }

.timeout { flex: 1; display: grid; place-items: center; text-align: center; align-content: center; gap: 14px; }
.timeout .emo { font-size: 120px; }

.free-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.sound-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.explore-card { background: var(--card); border-radius: 24px; padding: 14px; box-shadow: var(--shadow-sm); text-align: center; border: none; cursor: pointer; color: var(--ink); }
.explore-card .emo { font-size: 60px; }
.explore-card .lbl { font-size: 18px; font-weight: 900; }

.muted { color: var(--ink-soft); font-weight: 700; }
.center { text-align: center; }
.hidden { display: none !important; }
.row-wrap { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }

/* animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-7px); } 80% { transform: translateX(7px); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -20px) scale(.8); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.float { animation: float 2.4s ease-in-out infinite; }

@media (max-width: 520px) {
  .screen { padding-left: 12px; padding-right: 12px; gap: 10px; }
  .mode-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .home-actions { grid-template-columns: repeat(2, 1fr); }
  .btn-round { width: 52px; height: 52px; font-size: 24px; }
  .stage { padding: 12px 8px; border-radius: 24px; }
  .choices { gap: 10px; }
  .drag-src { min-width: 68px; min-height: 68px; font-size: 40px; }
  .slots .slot { width: 72px; height: 72px; font-size: 40px; }
  .slots .slot.txt { width: 56px; height: 68px; font-size: 36px; }
  .match-target .slot { width: 72px; height: 72px; }
  .guide .char { font-size: 44px; }
  .dpad { grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 58px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ================================================================
   TEMA (html[data-theme]) — latar beranimasi + warna
   ================================================================ */
:root { --on-bg: var(--ink); --on-bg-soft: var(--ink-soft); }
#scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#app { position: relative; z-index: 1; }
.sc { position: absolute; will-change: transform; }
.topbar .title, .section-title, .tier-head, .play-title, .logo p { color: var(--on-bg); }
.screen > .center.muted, .tier-head .muted { color: var(--on-bg-soft); }

/* --- Taman Ceria --- */

/* --- Dasar Laut --- */

/* --- Angkasa Malam --- */

/* --- Dunia Gula-gula --- */

/* pratonton tema di kedai */
.theme-prev { width: 100%; aspect-ratio: 4/3; border-radius: 16px; display: grid; place-items: center; font-size: 40px; font-family: var(--emoji); box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); }
.theme-prev.klasik { background: linear-gradient(180deg, #fff6e5, #fef0f6); }

@keyframes cloudMove { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 440px)); } }
@keyframes sunPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes sway { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes flutter { 0% { transform: translate(0, 0); } 25% { transform: translate(28vw, -40px); } 50% { transform: translate(55vw, 10px); } 75% { transform: translate(82vw, -30px); } 100% { transform: translate(calc(100vw + 120px), 0); } }
@keyframes swim { 0% { transform: translateX(0) translateY(0); } 50% { transform: translateX(55vw) translateY(-14px); } 100% { transform: translateX(calc(100vw + 160px)) translateY(0); } }
@keyframes rise { from { transform: translateY(0); opacity: .9; } to { transform: translateY(-110vh); opacity: 0; } }
@keyframes rays { from { transform: translateX(-30px); } to { transform: translateX(30px); } }
@keyframes twinkle { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes drift { from { transform: translateX(0) rotate(10deg); } to { transform: translateX(calc(100vw + 120px)) rotate(10deg); } }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-18px) rotate(8deg); } }
@media print { #scene { display: none; } }
/* teks "kelabu" yang berada terus di atas latar mengikut warna tema; dalam kad kekal asal */
.screen .muted { color: var(--on-bg-soft); }
.panel .muted, .modal .muted, .coll-item .muted, .daily-item .muted, .player-card .muted, .stage .muted, .explore-card .muted, .parent .muted { color: var(--ink-soft); }
