/* =========================================================
   Robo Koding — gaya tampilan
   ========================================================= */
/* Font Baloo 2 disimpan lokal (SIL Open Font License) — tanpa permintaan ke Google Fonts */
@font-face {
  font-family: 'Baloo 2'; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url('fonts/baloo2-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Baloo 2'; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url('fonts/baloo2-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #EAF6FF;
  --bg-dots: #D3ECFF;
  --card: #FFFFFF;
  --ink: #1F2A44;
  --ink-soft: #5B6782;
  --line: #D7E3F2;
  --go: #22B35E;
  --go-dark: #178A47;
  --soft: #EEF3FA;
  --danger: #E5484D;
  --sel: #2F8CF0;
  --gold: #FFC531;
  --tier: #2F8CF0;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(31, 42, 68, .10), 0 12px 28px rgba(31, 42, 68, .10);
  --font: 'Baloo 2', 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 2px, transparent 2.5px);
  background-size: 26px 26px;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 4px solid #FFB020; outline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }

#app { max-width: 1040px; margin: 0 auto; padding: 0 16px 40px; }
.screen { display: none; }
.screen.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- tombol ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 12px 22px; font-size: 1.1rem; font-weight: 700;
  background: var(--soft); box-shadow: 0 4px 0 rgba(31, 42, 68, .15);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(31, 42, 68, .15); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-go { background: var(--go); color: #fff; box-shadow: 0 4px 0 var(--go-dark); }
.btn-go:active { box-shadow: 0 1px 0 var(--go-dark); }
.btn-soft { background: #fff; border: 2px solid var(--line); }
.btn-danger { background: #fff; color: var(--danger); border: 2px solid #F6C6C8; }
.btn-big { font-size: 1.5rem; padding: 16px 40px; }
.btn-small { font-size: .95rem; padding: 8px 16px; }
.icon-btn {
  flex: none; width: 48px; height: 48px; border-radius: 16px; border: 2px solid var(--line);
  background: #fff; font-size: 1.4rem; display: grid; place-items: center;
  box-shadow: 0 3px 0 rgba(31, 42, 68, .1);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.fs-btn { color: var(--ink, #1F2A44); }
.fs-btn svg { width: 58%; height: 58%; }
.home-corner { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); z-index: 2; }
/* Layar penuh: latar tetap terang (bukan hitam) & halaman tetap bisa digulir */
html:fullscreen { background: var(--bg); overflow-y: auto; }
html:-webkit-full-screen { background: var(--bg); overflow-y: auto; }

/* ---------- beranda ---------- */
#screen-home.active { display: grid; place-items: center; min-height: 100vh; position: relative; }
.home-card {
  position: relative; z-index: 1; text-align: center; background: var(--card); border-radius: 36px;
  padding: 28px 28px 32px; box-shadow: var(--shadow); max-width: 460px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.home-bot { width: 150px; height: 150px; margin-top: -90px; filter: drop-shadow(0 8px 10px rgba(31,42,68,.15)); }
.home-bot svg { width: 100%; height: 100%; }
.logo { font-size: clamp(2.6rem, 9vw, 3.6rem); font-weight: 800; letter-spacing: -.5px; }
.logo .l1 { color: #2F8CF0; }
.logo .l2 { color: #FF9F43; }
.home-sub { margin: 0; color: var(--ink-soft); font-size: 1.15rem; }
.home-stars { font-size: 1.2rem; background: #FFF6D6; padding: 6px 16px; border-radius: 999px; margin: 4px 0 8px; }
.home-shapes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.home-shapes .fs { position: absolute; width: 64px; height: 64px; opacity: .85; animation: float 6s ease-in-out infinite; }
.fs1 { top: 10%; left: 6%; } .fs2 { top: 16%; right: 8%; animation-delay: -1s !important; }
.fs3 { bottom: 14%; left: 10%; animation-delay: -2s !important; } .fs4 { bottom: 10%; right: 10%; animation-delay: -3s !important; }
.fs5 { top: 50%; left: 2%; animation-delay: -4s !important; width: 44px !important; } .fs6 { top: 46%; right: 3%; animation-delay: -5s !important; width: 44px !important; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-16px) rotate(10deg); } }
.bob { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- bar atas ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 0 10px; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 75%, transparent); }
.topbar-title { font-size: clamp(1.25rem, 4vw, 1.7rem); flex: 1; min-width: 0; }
#screen-level .topbar { position: static; background: none; }
.chip-stars { background: #FFF6D6; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.lvl-head { flex: 1; min-width: 0; }
.lvl-kicker { font-size: .85rem; color: var(--tier); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- peta ---------- */
.tiers { display: flex; flex-direction: column; gap: 20px; }
.tier { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border-top: 8px solid var(--tier); }
.tier.locked { opacity: .7; }
.tier-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.tier-emoji { font-size: 2.2rem; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: color-mix(in srgb, var(--tier) 15%, white); flex: none; }
.tier-head > div:nth-child(2) { flex: 1; min-width: 0; }
.tier-kicker { font-size: .9rem; font-weight: 700; color: var(--tier); }
.tier h3 { font-size: clamp(1.15rem, 3.5vw, 1.45rem); }
.tier-score { font-weight: 700; white-space: nowrap; color: var(--ink-soft); }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lvl {
  border: 3px solid color-mix(in srgb, var(--tier) 35%, white); background: #fff; border-radius: 20px;
  padding: 12px 10px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--tier) 35%, white); transition: transform .1s;
}
.lvl:not(.locked):hover { transform: translateY(-2px); }
.lvl:active:not(.locked) { transform: translateY(3px); box-shadow: none; }
.lvl.done { background: color-mix(in srgb, var(--tier) 8%, white); }
.lvl.locked { cursor: not-allowed; filter: grayscale(1); opacity: .6; }
.lvl-num { width: 46px; height: 46px; border-radius: 50%; background: var(--tier); color: #fff; font-weight: 800; font-size: 1.4rem; display: grid; place-items: center; }
.lvl.locked .lvl-num { background: #CBD5E1; font-size: 1.1rem; }
.lvl-title { font-weight: 700; font-size: 1rem; line-height: 1.2; margin-top: 4px; }
.lvl-concept { font-size: .8rem; color: var(--ink-soft); }
.lvl-stars i { font-style: normal; font-size: 1.25rem; color: #D5DCE6; }
.lvl-stars i.on { color: var(--gold); text-shadow: 0 1px 0 #D99A00; }

/* ---------- pilih tingkat ---------- */
.tiers-intro { margin: 0 0 14px; color: var(--ink-soft); font-size: 1.1rem; font-weight: 600; }
.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.tier-group { margin: 0 0 26px; }
.tier-group:last-child { margin-bottom: 0; }
.group-head { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-size: 1.25rem; }
.gh-emoji {
  font-size: 1.6rem; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tier) 16%, white);
}
.gh-text { display: flex; flex-direction: column; line-height: 1.15; }
.gh-name { font-size: 1.3rem; font-weight: 800; color: var(--tier); }
.gh-text small { font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.gh-line { flex: 1; height: 3px; min-width: 16px; border-radius: 3px; background: color-mix(in srgb, var(--tier) 25%, white); }
.gh-count {
  font-size: .95rem; font-weight: 800; color: var(--ink-soft); background: #fff;
  border: 2px solid color-mix(in srgb, var(--tier) 30%, white); border-radius: 999px; padding: 2px 12px;
}
.group-note { margin: 0 0 12px; color: var(--ink-soft); font-size: .98rem; font-weight: 600; }
.tier-card {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "emoji body" "foot foot";
  gap: 12px 16px; align-items: center; text-align: left; padding: 18px 18px 16px; border: 0; border-radius: var(--radius);
  background: var(--card); box-shadow: 0 6px 0 color-mix(in srgb, var(--tier) 45%, white), 0 12px 26px rgba(31, 42, 68, .1);
  border-top: 10px solid var(--tier); transition: transform .12s, box-shadow .12s;
}
.tier-card:hover { transform: translateY(-3px); }
.tier-card:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--tier) 45%, white); }
.tier-card.complete { background: color-mix(in srgb, var(--tier) 7%, white); }
.tc-emoji {
  grid-area: emoji; font-size: 3rem; width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tier) 16%, white);
}
.tc-body { grid-area: body; display: flex; flex-direction: column; min-width: 0; padding-right: 34px; }
.tc-kicker { font-weight: 800; color: var(--tier); font-size: .95rem; }
.tc-name { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.tc-theme { font-size: 1.1rem; font-weight: 600; color: var(--ink-soft); }
.tc-age { align-self: flex-start; margin-top: 6px; font-size: .9rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--tier) 14%, white); color: color-mix(in srgb, var(--tier) 70%, #222); }
.tc-foot { grid-area: foot; display: flex; flex-direction: column; gap: 6px; }
.tc-bar { height: 12px; border-radius: 999px; background: #E9EEF5; overflow: hidden; }
.tc-bar i { display: block; height: 100%; background: var(--tier); border-radius: 999px; transition: width .4s; }
.tc-stats { display: flex; justify-content: space-between; font-weight: 700; color: var(--ink-soft); font-size: .95rem; }
.tc-go {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: var(--tier); color: #fff;
  display: grid; place-items: center; font-size: 1rem;
}
.tier-concept { margin: 0 0 14px; color: var(--ink-soft); font-weight: 600; background: color-mix(in srgb, var(--tier) 8%, white); border-radius: 14px; padding: 10px 14px; }
.tier-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
#screen-map .lvl-kicker { color: var(--tier); }

/* ---------- pelatih (Robo + gelembung) ---------- */
.coach { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.coach-bot { width: 70px; height: 70px; flex: none; }
.coach-bot svg { width: 100%; height: 100%; }
.coach-bot.jump { animation: jump .5s ease; }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px) rotate(-6deg); } }
.bubble {
  position: relative; background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 10px 16px;
  flex: 1; box-shadow: 0 4px 0 rgba(31, 42, 68, .07); transition: background .2s, border-color .2s;
}
.bubble::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  border: 10px solid transparent; border-right-color: var(--line); border-left: 0;
}
.bubble-text { margin: 0; font-size: clamp(1.05rem, 3.2vw, 1.25rem); font-weight: 600; line-height: 1.3; }
.bubble.good { background: #E7F9EE; border-color: #8BDCAB; }
.bubble.good::before { border-right-color: #8BDCAB; }
.bubble.oops { background: #FFF3E6; border-color: #FFC58A; }
.bubble.oops::before { border-right-color: #FFC58A; }
.bubble.info { background: #EAF4FF; border-color: #9CCBF6; }
.bubble.info::before { border-right-color: #9CCBF6; }
.tip { background: #FFF9DB; border: 2px dashed #F5D565; border-radius: 16px; padding: 8px 14px; margin: 0 0 12px; font-weight: 600; color: #6B5300; }

.stage { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.pad-label { margin: 14px 0 6px; font-weight: 700; color: var(--ink-soft); text-align: center; }

/* ---------- animasi umpan balik ---------- */
.shake { animation: shake .45s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.hint { animation: hint 1.6s ease; }
@keyframes hint { 0%, 100% { transform: scale(1); box-shadow: none; } 20%, 60% { transform: scale(1.15); box-shadow: 0 0 0 6px #FFD54A; } 40%, 80% { transform: scale(1.05); } }
.wiggle { animation: wiggle .5s ease; transform-box: fill-box; transform-origin: center; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) scale(1.1); } 75% { transform: rotate(14deg) scale(1.1); } }
.draw { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw .5s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- MESIN: POLA ---------- */
.pattern { display: flex; flex-direction: column; gap: 12px; }
.prow {
  display: grid; grid-template-columns: repeat(var(--n, 8), 1fr); gap: clamp(4px, 1.2vw, 10px);
  border: 3px solid var(--line); border-radius: 26px; padding: clamp(8px, 1.6vw, 14px);
  transition: opacity .3s, border-color .3s, background .3s;
}
.prow.upcoming { opacity: .4; }
.prow.active { border-color: var(--tier); background: color-mix(in srgb, var(--tier) 6%, white); }
.prow.done { border-color: #8BDCAB; background: #F1FBF4; }
.pslot { aspect-ratio: 1; border: 3px dashed #C4D0E0; border-radius: 12px; display: grid; place-items: center; max-width: 72px; width: 100%; justify-self: center; }
.pslot.filled { border-color: transparent; }
.pslot svg { width: 100%; height: 100%; }
.pslot.next { border-color: var(--tier); border-style: solid; animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tier) 40%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--tier) 25%, transparent); } }
.palette { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.pal-btn {
  width: 78px; height: 78px; border-radius: 22px; border: 3px solid var(--line); background: #fff; padding: 10px;
  box-shadow: 0 5px 0 var(--line); transition: transform .08s;
}
.pal-btn svg { width: 100%; height: 100%; }
.pal-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }

/* ---------- MESIN: MENCOCOKKAN ---------- */
.match { position: relative; display: grid; grid-template-columns: 1fr minmax(30px, 140px) 1fr; max-width: 640px; margin: 0 auto; }
.match-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.mcol { display: flex; flex-direction: column; gap: 14px; }
.mcol .mcard { flex: 1; }
.mcol.left { grid-column: 1; } .mcol.right { grid-column: 3; }
.mgap { grid-column: 2; }
.mcard {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--line); border-radius: 20px;
  padding: 10px; box-shadow: 0 4px 0 var(--line); transition: border-color .15s, transform .1s, background .2s;
}
.mcol.left .mcard { justify-content: space-between; }
.mcol.right .mcard { justify-content: space-between; }
.mcard .art { flex: 1; display: grid; place-items: center; }
.match-grid .mcard .art svg { width: min(90px, 100%); height: auto; border-radius: 4px; }
.match-car .mcard .art svg { width: min(130px, 100%); height: auto; }
.mdot { width: 18px; height: 18px; border-radius: 50%; background: var(--ink); flex: none; }
.mcard.sel { border-color: var(--sel); background: #EAF4FF; transform: scale(1.03); }
.mcard.matched { border-color: #8BDCAB; background: #F1FBF4; box-shadow: 0 4px 0 #BFEACF; cursor: default; }

.ring-wrap { max-width: 520px; margin: 0 auto; }
.ring { width: 100%; height: auto; display: block; overflow: visible; }
.rdot { cursor: pointer; stroke: #fff; stroke-width: 1; transition: r .15s; transform-box: fill-box; transform-origin: center; }
.rdot:hover { r: 6.4; }
.rdot.sel { stroke: var(--ink); stroke-width: 1.4; r: 7; }
.rdot.done { stroke: #1F2937; stroke-width: .8; cursor: default; }
.rdot:focus, .cdot-g:focus { outline: none; }
.rdot:focus-visible { outline: none; stroke: #FFB020; stroke-width: 1.6; }

/* ---------- MESIN: KODE RAHASIA ---------- */
.keybox { background: #F6F9FD; border: 3px solid var(--line); border-radius: 20px; padding: 10px 12px 12px; margin-bottom: 14px; }
.key-title { font-weight: 800; color: var(--ink-soft); margin-bottom: 6px; text-align: center; }
.key-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; }
.key-item { display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 16px; padding: 4px; }
.key-item .kc { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(31, 42, 68, .25); }
.key-item .kv { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.key-item.stack { flex-direction: column; }
.key-item .kv.box { width: 46px; height: 40px; border: 3px solid var(--ink); border-radius: 10px; display: grid; place-items: center; font-size: 1.4rem; background: #fff; }
.crows { display: flex; flex-direction: column; gap: 10px; }
.crow {
  position: relative; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px;
  border: 3px solid var(--line); border-radius: 22px; padding: 12px 10px; transition: opacity .3s, border-color .3s, background .3s;
  opacity: .5;
}
.crow.active { opacity: 1; border-color: var(--tier); background: color-mix(in srgb, var(--tier) 6%, white); }
.crow.done, .crow.example { opacity: 1; border-color: #8BDCAB; background: #F1FBF4; }
.crow.example { border-style: dashed; }
.ex-tag { position: absolute; top: -12px; left: 16px; background: #8BDCAB; color: #0B5130; font-size: .8rem; font-weight: 800; padding: 0 10px; border-radius: 999px; }
.cleft, .cright { display: flex; align-items: center; gap: 6px; }
.cdot { width: clamp(32px, 7vw, 46px); height: clamp(32px, 7vw, 46px); border-radius: 50%; display: inline-block; border: 3px solid rgba(31, 42, 68, .2); flex: none; }
.cdot.in { width: 80%; height: 80%; }
.ctile { width: clamp(32px, 7vw, 46px); height: clamp(32px, 7vw, 46px); border-radius: 12px; background: #fff; border: 3px solid var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; }
.op, .eq { font-size: 1.8rem; font-weight: 800; color: var(--ink-soft); }
.cslot {
  width: clamp(36px, 7.6vw, 50px); height: clamp(36px, 7.6vw, 50px); border-radius: 50%; border: 3px solid var(--ink);
  background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem;
}
.cright.single .cslot { border-radius: 12px; width: clamp(52px, 11vw, 64px); }
.cslot.next { border-color: var(--tier); animation: glow 1.2s ease-in-out infinite; }
.cslot.filled { background: #FFFDF4; }
.reveal { font-size: 1.4rem; font-weight: 800; min-width: 0; opacity: 0; transform: scale(.5); transition: all .35s cubic-bezier(.3, 1.6, .5, 1); }
.reveal:empty { display: none; }
.reveal.on { opacity: 1; transform: scale(1); }
.reveal.tick { color: var(--go); font-size: 1.8rem; }
.pad { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.pad-btn {
  min-width: 60px; height: 60px; padding: 0 10px; border-radius: 18px; border: 3px solid var(--line); background: #fff;
  font-size: 1.8rem; font-weight: 800; box-shadow: 0 5px 0 var(--line); display: grid; place-items: center;
}
.pad-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.pad-color .pad-btn { width: 66px; height: 66px; }
.pad-color .pad-btn .cdot { width: 44px; height: 44px; }

/* ---------- MESIN: KONEKSI ---------- */
.connect-play { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.puzzle-count { font-weight: 700; color: var(--ink-soft); }
.codestrip { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 4px; }
.codestrip .cs { width: 46px; height: 46px; border: 3px solid var(--ink); border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; background: #fff; transition: all .2s; }
.codestrip .cs.now { background: var(--tier); color: #fff; border-color: var(--tier); transform: scale(1.12); }
.codestrip .cs.ok { background: #E7F9EE; border-color: #8BDCAB; color: #178A47; }
.codestrip .arr { font-size: 1.2rem; color: var(--ink-soft); }
.cboard-wrap { width: 100%; max-width: 460px; background: #F6F9FD; border-radius: 22px; padding: 6px; border: 3px solid var(--line); }
.cboard { width: 100%; height: auto; display: block; overflow: visible; }
.cdot-g { cursor: pointer; transform-box: fill-box; transform-origin: center; }
.cdot-g .cdot-c { transition: stroke-width .15s; }
.cdot-g:hover .cdot-c { stroke-width: 5; }
.cdot-g.visited .cdot-c { stroke-width: 6; }
.cbadge { font-family: var(--font); font-weight: 800; font-size: 22px; fill: #fff; paint-order: stroke; stroke: #1F2937; stroke-width: 4px; pointer-events: none; }
.cdot-g:focus-visible { outline: none; }
.cdot-g:focus-visible .cdot-c { stroke: #FFB020; stroke-width: 6; }

/* ---------- MESIN: ROBOT ---------- */
.robot-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .robot-layout { grid-template-columns: 1fr; } }
.board-wrap { display: flex; justify-content: center; }
.board {
  position: relative; display: grid; width: 100%; max-width: calc(var(--cols) * 84px);
  grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr);
  aspect-ratio: var(--cols) / var(--rows); border-radius: 18px; overflow: hidden; border: 4px solid #4C8C3A;
  background: #A7DE7A;
}
.cell { background: #B5E58A; display: grid; place-items: center; }
.cell.alt { background: #A3D976; }
.tree { font-size: clamp(1.6rem, 6vw, 2.6rem); line-height: 1; }
.piece {
  position: absolute; left: 0; top: 0; width: calc(100% / var(--cols)); height: calc(100% / var(--rows));
  display: grid; place-items: center; transition: transform .42s cubic-bezier(.4, 1.3, .6, 1); pointer-events: none;
}
.brobot svg { width: 82%; height: 82%; filter: drop-shadow(0 4px 2px rgba(0, 0, 0, .2)); }
.brobot.bump svg { animation: shake .4s ease; }
.brobot.happy svg { animation: jump .5s ease 2; }
.bstar span { font-size: clamp(1.4rem, 5.5vw, 2.3rem); animation: twinkle 1.6s ease-in-out infinite; display: inline-block; }
.bstar.got span { animation: collect .5s ease forwards; }
@keyframes twinkle { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12) rotate(8deg); } }
@keyframes collect { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.7) translateY(-12px); opacity: 1; } 100% { transform: scale(.2) translateY(-30px); opacity: 0; } }

.controls { display: flex; flex-direction: column; gap: 8px; }
.controls.busy .cmdpad, .controls.busy .program { opacity: .65; pointer-events: none; }
.prog-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.blockcount { font-size: .95rem; background: var(--soft); padding: 2px 12px; border-radius: 999px; color: var(--ink-soft); }
.blockcount.full { background: #FFE9D2; color: #A2560B; }
.program {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 76px; padding: 10px;
  background: #F6F9FD; border: 3px dashed #C4D0E0; border-radius: 18px;
}
.prog-empty { color: var(--ink-soft); font-weight: 600; padding: 0 6px; }
.blk, .cmd { border: 0; display: grid; place-items: center; color: #fff; border-radius: 14px; }
.blk { width: 48px; height: 48px; box-shadow: 0 4px 0 rgba(0, 0, 0, .18); transition: transform .12s, box-shadow .12s; }
.blk svg, .cmd svg { width: 62%; height: 62%; }
.dir-up { background: #2F8CF0; } .dir-down { background: #E2579A; } .dir-left { background: #F08A24; } .dir-right { background: #22B35E; }
.dir-up svg { transform: rotate(-90deg); } .dir-down svg { transform: rotate(90deg); } .dir-left svg { transform: rotate(180deg); }
.blk.sel { outline: 4px solid var(--ink); outline-offset: 2px; transform: translateY(-3px); }
.blk.running, .loopblk.running { box-shadow: 0 0 0 5px #FFD54A; transform: scale(1.08); }
.loopblk {
  display: flex; align-items: center; gap: 4px; background: #EDE4FC; border: 3px solid #A98BE5; border-radius: 16px; padding: 4px;
  transition: box-shadow .15s, transform .15s;
}
.loopblk.open { border-style: dashed; border-color: #7C4FD8; background: #E4D7FB; }
.loop-head { border: 0; background: #8E5BE0; color: #fff; width: 40px; height: 48px; border-radius: 12px; font-size: 1.3rem; }
.loop-count { border: 0; background: #fff; color: #5B2DB5; font-weight: 800; font-size: 1.15rem; height: 48px; min-width: 44px; border-radius: 12px; box-shadow: inset 0 0 0 2px #A98BE5; }
.loop-body { display: flex; flex-wrap: wrap; gap: 4px; min-width: 52px; min-height: 48px; align-items: center; padding: 0 4px; }
.loop-empty { color: #7C4FD8; font-weight: 700; font-size: .85rem; }
.cmdpad { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 10px; }
.cmd { height: 66px; min-width: 0; box-shadow: 0 5px 0 rgba(0, 0, 0, .2); }
.cmd:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.cmd.loopbtn { background: #8E5BE0; padding: 0 14px; font-size: 1.5rem; display: flex; flex-direction: column; gap: 0; line-height: 1; }
.cmd.loopbtn small { font-size: .85rem; font-weight: 800; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.actions .btn-run { flex: 1 1 100%; font-size: 1.35rem; padding: 14px; }
.actions .btn-soft { flex: 1; }

/* ---------- MESIN BALITA (2–3 tahun) ---------- */
.stage.toddler { padding: clamp(14px, 3vw, 28px); }
#screen-level.toddler .bubble-text { font-size: clamp(1.2rem, 3.8vw, 1.5rem); }
.stage.toddler .pslot { max-width: 110px; }
.stage.toddler .pal-btn { width: 110px; height: 110px; border-radius: 30px; padding: 16px; }
.big-emoji { font-size: 1em; line-height: 1; display: inline-block; }
.t-progress { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; }
.t-progress i { width: 18px; height: 18px; border-radius: 50%; background: #E3E9F2; transition: background .3s, transform .3s; }
.t-progress i.on { background: var(--gold); transform: scale(1.2); box-shadow: 0 2px 0 #D99A00; }

.sort-item { width: clamp(130px, 34vw, 190px); height: clamp(130px, 34vw, 190px); margin: 0 auto 22px; display: grid; place-items: center; font-size: clamp(100px, 26vw, 150px); }
.sort-item svg { width: 100%; height: 100%; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .15)); }
.sort-item.fly { animation: flyDown .6s ease forwards; }
@keyframes flyDown { to { transform: translateY(140px) scale(.2); opacity: 0; } }
.bins { display: flex; justify-content: center; gap: clamp(10px, 3vw, 28px); }
.bin {
  flex: 1; max-width: 220px; min-height: 150px; border: 6px solid var(--c); border-top-width: 10px;
  border-radius: 14px 14px 46px 46px; background: color-mix(in srgb, var(--c) 18%, white);
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 10px 8px 12px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 55%, #333);
}
.bin:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 55%, #333); }
.bin-in { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 40px; }
.bin-thing { width: 36px; height: 36px; display: grid; place-items: center; font-size: 30px; animation: pop .35s ease; }
.bin-thing svg { width: 100%; height: 100%; }
.bin-label { font-size: 1.35rem; font-weight: 800; color: color-mix(in srgb, var(--c) 70%, #222); text-transform: capitalize; }

.pairs { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: clamp(10px, 3vw, 22px); max-width: 560px; margin: 0 auto; }
.pcard {
  aspect-ratio: 1; border: 5px solid var(--line); border-radius: 28px; background: #fff; font-size: clamp(54px, 15vw, 96px);
  display: grid; place-items: center; box-shadow: 0 6px 0 var(--line); transition: transform .2s, opacity .4s, border-color .2s, background .2s;
}
.pcard.sel { border-color: var(--sel); background: #EAF4FF; transform: scale(1.06); }
.pcard.gone { opacity: 0; transform: scale(.4) rotate(20deg); pointer-events: none; }

.seq-slots { display: flex; justify-content: center; align-items: center; gap: clamp(6px, 2vw, 16px); }
.seq-slot {
  position: relative; width: clamp(92px, 24vw, 140px); aspect-ratio: 1; border: 5px dashed #C4D0E0; border-radius: 26px;
  display: grid; place-items: center; font-size: clamp(56px, 15vw, 90px); background: #F6F9FD;
}
.seq-slot.filled { border-style: solid; border-color: #8BDCAB; background: #F1FBF4; }
.seq-num { position: absolute; top: -14px; left: -10px; width: 36px; height: 36px; border-radius: 50%; background: var(--tier); color: #fff; font-size: 1.2rem; display: grid; place-items: center; }
.seq-arrow { font-size: 2rem; color: var(--ink-soft); }
.seq-cards { display: flex; justify-content: center; flex-wrap: wrap; gap: clamp(10px, 3vw, 22px); }
.seq-card {
  width: clamp(110px, 28vw, 150px); border: 5px solid var(--line); border-radius: 26px; background: #fff; padding: 10px 6px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: clamp(56px, 15vw, 84px); box-shadow: 0 6px 0 var(--line);
  transition: opacity .3s, transform .3s;
}
.seq-card small { font-size: 1rem; font-weight: 700; color: var(--ink-soft); }
.seq-card.used { opacity: .2; transform: scale(.85); pointer-events: none; }

.hop-wrap { display: flex; justify-content: center; margin-bottom: 20px; }
.hop-board { max-width: calc(var(--cols) * 130px); }
.hop-board .piece span { font-size: clamp(48px, 13vw, 84px); line-height: 1; display: inline-block; }
.hop-bunny { z-index: 2; }
.hop-bunny span.hopping { animation: hop .42s ease; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-30%) scale(1.1); } }
.hop-carrot span { animation: twinkle 1.6s ease-in-out infinite; }
.hop-pad { display: flex; justify-content: center; gap: 22px; }
.cmd.hop-btn { width: clamp(110px, 30vw, 150px); height: clamp(110px, 30vw, 150px); border-radius: 32px; }

/* ---------- CODING BALITA (robot lebah & balok perintah) ---------- */
.lvl-ref { font-size: .72rem; font-weight: 700; color: #C0392B; background: #FDECEA; border-radius: 999px; padding: 0 8px; }
.tip .ref { display: block; font-weight: 700; color: #8A6D00; opacity: .85; margin-top: 2px; }
.tip > .ref:first-child { margin-top: 0; }

.arrow-sample { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 18px; }
.as-label { font-size: 1.5rem; font-weight: 800; color: var(--ink-soft); }
.arrow-tile {
  display: grid; place-items: center; border: 0; border-radius: 24px; background: #5B6782; color: #fff;
  width: clamp(84px, 24vw, 120px); aspect-ratio: 1; box-shadow: 0 6px 0 #3E475C; transition: background .2s, transform .15s;
}
.arrow-tile svg { width: 62%; height: 62%; }
.arrow-tile.big { width: clamp(96px, 26vw, 130px); background: var(--tier); box-shadow: 0 6px 0 color-mix(in srgb, var(--tier) 60%, #222); border-radius: 28px; }
.r-up svg { transform: rotate(-90deg); } .r-down svg { transform: rotate(90deg); } .r-left svg { transform: rotate(180deg); }
.arrow-grid { display: grid; grid-template-columns: repeat(3, auto); justify-content: center; gap: clamp(10px, 3vw, 22px); }
.arrow-tile.found { background: #22B35E; box-shadow: 0 6px 0 #178A47; position: relative; }
.arrow-tile.found::after { content: '✓'; position: absolute; top: -10px; right: -10px; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #178A47; font-weight: 800; font-size: 1.3rem; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }

.bee-board { max-width: calc(var(--cols) * 120px); }
.cell.colored { background: color-mix(in srgb, var(--c) 80%, white); box-shadow: inset 0 0 0 4px rgba(255,255,255,.55); }
.bee-goal { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.4rem; font-weight: 800; color: var(--ink-soft); margin-bottom: 10px; }
.goal-swatch { width: 54px; height: 54px; border-radius: 14px; border: 4px solid rgba(31,42,68,.25); }
.goal-emoji { font-size: 44px; line-height: 1; }
.cell.goal { animation: goalPulse 1.4s ease-in-out infinite; }
@keyframes goalPulse { 0%, 100% { box-shadow: inset 0 0 0 4px rgba(255,255,255,.55); } 50% { box-shadow: inset 0 0 0 9px #fff; } }
.start-mark { font-size: .75rem; font-weight: 800; color: #3B6B2A; background: rgba(255,255,255,.7); padding: 0 8px; border-radius: 999px; align-self: end; margin-bottom: 6px; }
.bee-prog {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; min-height: 66px; margin: 0 auto 14px; max-width: 520px;
  padding: 8px 12px; background: #F6F9FD; border: 3px dashed #C4D0E0; border-radius: 18px;
}
.bee-label { font-weight: 800; color: var(--ink-soft); margin-right: 4px; }
.bee-prog .blk { width: 46px; height: 46px; }
.bee-pad { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bee-arrows { display: flex; gap: 16px; }
.cmd.bee-btn { width: clamp(96px, 26vw, 120px); height: clamp(96px, 26vw, 120px); border-radius: 30px; }
.bee-actions { display: flex; gap: 12px; width: 100%; max-width: 460px; }
.bee-clear { flex: 1; }
.bee-go, .kibo-go { flex: 2; font-size: 1.6rem; padding: 16px; }
.bee-go.ready, .kibo-go.ready { animation: glowGo 1.2s ease-in-out infinite; }
@keyframes glowGo { 0%, 100% { box-shadow: 0 4px 0 var(--go-dark), 0 0 0 0 rgba(34,179,94,.5); } 50% { box-shadow: 0 4px 0 var(--go-dark), 0 0 0 10px rgba(34,179,94,0); } }

.kibo-top { display: flex; justify-content: center; align-items: center; gap: clamp(14px, 4vw, 40px); flex-wrap: wrap; margin-bottom: 16px; }
.kibo-card { background: #FFF9DB; border: 4px solid #F5D565; border-radius: 22px; padding: 10px 16px 14px; text-align: center; transform: rotate(-2deg); box-shadow: 0 6px 0 #EAC64A; }
.kc-title { font-weight: 800; color: #8A6D00; margin-bottom: 6px; }
.kc-items { display: flex; gap: 8px; }
.kc-item { width: 64px; height: 64px; display: grid; place-items: center; font-size: 42px; background: #fff; border-radius: 16px; border: 3px solid #F5D565; }
.kibo-bot { position: relative; width: clamp(130px, 34vw, 170px); height: clamp(130px, 34vw, 170px); border-radius: 50%; display: grid; place-items: center; transition: box-shadow .2s, background .2s; }
.kibo-bot.lit { background: radial-gradient(circle, #FFF6B0 0%, rgba(255,246,176,0) 70%); box-shadow: 0 0 40px 10px rgba(255,214,64,.6); }
.kibo-robo { width: 80%; height: 80%; }
.kibo-robo svg { width: 100%; height: 100%; }
.kibo-robo.spin { animation: spin360 .85s ease-in-out; }
.kibo-robo.jumping { animation: jumpHigh .85s ease; }
.kibo-robo.waving { animation: wave .85s ease; }
@keyframes spin360 { to { transform: rotate(360deg); } }
@keyframes jumpHigh { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-40px); } 60% { transform: translateY(0); } 75% { transform: translateY(-14px); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(-12deg); } 40%, 80% { transform: rotate(12deg); } }
.kibo-fx { position: absolute; top: -14px; right: -18px; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 2px 12px; font-weight: 800; font-size: 1.3rem; opacity: 0; transform: scale(.4); transition: all .25s cubic-bezier(.3,1.6,.5,1); pointer-events: none; }
.kibo-fx.show { opacity: 1; transform: scale(1); }
.kibo-fx:empty { display: none; }
.kibo-strip { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.kb-end { font-weight: 800; padding: 10px 12px; border-radius: 14px; color: #fff; font-size: 1rem; }
.kb-end.start { background: #22B35E; } .kb-end.stop { background: #E5484D; }
.kb-slot { width: 68px; height: 68px; border: 4px dashed #C4D0E0; border-radius: 16px; background: #F6F9FD; display: grid; place-items: center; font-size: 40px; color: #C4D0E0; font-weight: 800; }
.kb-slot.next { border-color: var(--tier); animation: glow 1.2s ease-in-out infinite; }
.kb-slot.filled { border: 4px solid #5B6782; background: #fff; color: inherit; box-shadow: 0 4px 0 #C4D0E0; }
.kb-slot.running { box-shadow: 0 0 0 6px #FFD54A; transform: scale(1.08); }
.kibo-palette { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.kibo-block {
  width: clamp(92px, 24vw, 116px); border: 4px solid var(--line); border-radius: 24px; background: #fff; padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; font-size: clamp(44px, 12vw, 56px); box-shadow: 0 6px 0 var(--line);
}
.kibo-block small { font-size: 1rem; font-weight: 800; color: var(--ink-soft); }
.kibo-block:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--line); }
.stage-blocks .kibo-go { display: block; margin: 0 auto; min-width: 220px; }

/* ---------- tambahan balita: bagian, ukuran, bentuk, batu, banyak bunga ---------- */
.lvl-section { grid-column: 1 / -1; margin: 6px 0 -2px; font-size: 1.1rem; color: var(--tier); display: flex; align-items: center; gap: 10px; }
.lvl-section::after { content: ''; flex: 1; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--tier) 25%, white); }
.levels .lvl-section:first-child { margin-top: 0; }
.big-emoji.sz-big { font-size: 1em; }
.big-emoji.sz-small { font-size: .45em; }
.sort-item .sz-small { font-size: .45em; }
.bin-icon { font-size: 2rem; line-height: 1; }
.bin-icon svg { width: 40px; height: 40px; }
.bins.many { gap: 8px; }
.bins.many .bin { min-height: 130px; padding: 8px 4px 10px; border-width: 5px; }
.bins.many .bin-label { font-size: clamp(.9rem, 3.4vw, 1.25rem); }
.bins.many .bin-thing { width: 30px; height: 30px; font-size: 24px; }
.rock { font-size: clamp(1.8rem, 8vw, 3rem); line-height: 1; }
.bee-flower.got span { animation: collect .5s ease forwards; }
/* ---------- balita 4 bagian ---------- */
.lvl-section { flex-wrap: wrap; }
.lvl-section::after { display: none; }
.sec-badge { font-size: 1.7rem; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--tier) 12%, white); filter: grayscale(1); opacity: .55; }
.lvl-section.complete .sec-badge { filter: none; opacity: 1; background: #FFF3C4; box-shadow: 0 0 0 3px var(--gold); }
.sec-text { display: flex; flex-direction: column; line-height: 1.15; }
.sec-name { font-size: 1.15rem; }
.sec-text small { font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.sec-line { flex: 1; height: 3px; min-width: 20px; border-radius: 3px; background: color-mix(in srgb, var(--tier) 25%, white); }
.sec-count { font-size: .95rem; font-weight: 800; color: var(--ink-soft); background: #fff; border: 2px solid color-mix(in srgb, var(--tier) 30%, white); border-radius: 999px; padding: 2px 12px; }
.lvl-section.complete .sec-count { color: #8A6D00; border-color: var(--gold); background: #FFF9DB; }
.find-tile {
  display: grid; place-items: center; width: clamp(84px, 24vw, 120px); aspect-ratio: 1; border-radius: 24px; padding: 12px;
  border: 4px solid var(--line); background: #fff; box-shadow: 0 6px 0 var(--line); font-size: clamp(48px, 13vw, 70px); position: relative;
}
.find-tile svg { width: 100%; height: 100%; }
.find-tile.big { width: clamp(96px, 26vw, 130px); border-color: var(--tier); box-shadow: 0 6px 0 color-mix(in srgb, var(--tier) 45%, white); }
.find-tile.found { border-color: #22B35E; background: #E7F9EE; box-shadow: 0 6px 0 #8BDCAB; }
.find-tile.found::after { content: '✓'; position: absolute; top: -10px; right: -10px; width: 34px; height: 34px; border-radius: 50%; background: #22B35E; color: #fff; font-weight: 800; font-size: 1.3rem; display: grid; place-items: center; }
.tok-emoji { font-size: clamp(26px, 7vw, 56px); line-height: 1; }
.pal-btn .tok-emoji { font-size: 44px; }
.stage.toddler .pal-btn .tok-emoji { font-size: 64px; }
.hop-board, .bee-board { max-width: calc(var(--cols) * min(120px, calc(52vh / var(--rows)))) !important; }
.hop-pad.dpad { display: grid; grid-template-columns: repeat(3, auto); grid-template-areas: ". up ." "left . right" ". down ."; gap: 8px; justify-content: center; }
.hop-pad.dpad .cmd.hop-btn { width: clamp(80px, 22vw, 104px); height: clamp(80px, 22vw, 104px); border-radius: 26px; }
.hop-pad.dpad .dir-up { grid-area: up; } .hop-pad.dpad .dir-down { grid-area: down; }
.hop-pad.dpad .dir-left { grid-area: left; } .hop-pad.dpad .dir-right { grid-area: right; }
.kibo-strip.long .kb-slot { width: 54px; height: 54px; font-size: 30px; }
@media (max-width: 560px) { .kibo-strip.long .kb-slot { width: 46px; height: 46px; font-size: 26px; border-width: 3px; } .bee-arrows { gap: 10px; } }

/* ---------- Pemula 3 bagian ---------- */
svg.tok-small { transform: scale(.55); }
.silhouette { filter: brightness(0) opacity(.85); }
.match-shadow .mcard .art, .match-count .mcard .art { font-size: clamp(40px, 11vw, 64px); min-height: 70px; }
.match-mirror .mcard .art svg, .match-grid .mcard .art svg { width: min(90px, 100%); height: auto; }
.count-objs { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 150px; font-size: clamp(22px, 6vw, 32px); line-height: 1.1; }
.count-dots { display: flex; align-items: center; gap: 8px; }
.count-dots svg { width: clamp(48px, 13vw, 64px); height: auto; }
.count-dots b { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.arrow-sample[hidden] { display: none; }
.arrow-grid.many { grid-template-columns: repeat(4, auto); }
.arrow-grid.many .arrow-tile { width: clamp(64px, 19vw, 100px); }
.arrow-grid.find-row { grid-template-columns: repeat(var(--n), minmax(0, 76px)); gap: clamp(4px, 1.4vw, 10px); }
.find-row .find-tile { width: 100%; padding: 6px; border-radius: 14px; border-width: 3px; box-shadow: 0 4px 0 var(--line); font-size: clamp(22px, 6vw, 44px); }
.find-row .find-tile .tok-emoji { font-size: inherit; }
.find-row .find-tile.found::after { width: 24px; height: 24px; font-size: .9rem; top: -8px; right: -8px; }
.make-row { margin-bottom: 6px; }
.make-row .pslot.unit { border-color: var(--tier); border-style: solid; background: color-mix(in srgb, var(--tier) 8%, white); }
.make-actions { display: flex; justify-content: center; margin-top: 12px; }
.order-track { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; padding: 10px; background: #F6F9FD; border: 3px dashed #C4D0E0; border-radius: 18px; }
.order-slot { width: clamp(46px, 12vw, 70px); height: clamp(46px, 12vw, 70px); border-radius: 14px; border: 3px dashed #C4D0E0; background: #fff; display: grid; place-items: center; font-size: clamp(28px, 8vw, 46px); overflow: hidden; }
.order-slot.next { border-color: var(--tier); border-style: solid; animation: glow 1.2s ease-in-out infinite; }
.order-slot.filled { border-style: solid; border-color: #8BDCAB; background: #F1FBF4; }
.order-pool { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.order-tile {
  width: clamp(64px, 18vw, 96px); height: clamp(64px, 18vw, 96px); border-radius: 20px; border: 4px solid var(--line); background: #fff;
  box-shadow: 0 5px 0 var(--line); display: grid; place-items: center; font-size: clamp(40px, 11vw, 64px); transition: opacity .3s, transform .3s;
}
.order-tile.used { opacity: .15; transform: scale(.85); pointer-events: none; }
.order-num { font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 800; color: var(--ink); }
.order-slot .order-num { font-size: clamp(1.3rem, 4vw, 1.9rem); }
.seq-slots, .seq-cards { flex-wrap: wrap; }
.seq-slots.four .seq-slot { width: clamp(64px, 18vw, 110px); font-size: clamp(40px, 11vw, 64px); }
.seq-slots.four .seq-arrow { font-size: 1.3rem; }
.seq-cards.four .seq-card { width: clamp(76px, 21vw, 120px); font-size: clamp(40px, 11vw, 60px); }
.seq-cards.four .seq-card small { font-size: .8rem; }

/* ---------- Penjelajah 3 bagian ---------- */
.cdot.sq { border-radius: 8px; }
.cleft.squares { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; }
.csym { display: inline-grid; place-items: center; flex: none; width: clamp(32px, 7vw, 46px); height: clamp(32px, 7vw, 46px); }
.cemoji { font-size: clamp(24px, 6vw, 34px); line-height: 1; }
.cshape svg { width: 100%; height: 100%; }
.key-item .csym.kc { width: 46px; height: 46px; border: 0; }
.key-item .cemoji.kc { font-size: 34px; }
.key-item .ctile.kc { font-size: 1.4rem; }
.cslot .csym.in { width: 80%; height: 80%; }
.cslot .cemoji.in { font-size: 24px; }
.pad-color .pad-btn .csym { width: 44px; height: 44px; }
.pad-color .pad-btn .cemoji { font-size: 34px; }
.op.op-word { font-size: 1.1rem; }
.cn { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cn .cdot { width: clamp(26px, 6vw, 40px); height: clamp(26px, 6vw, 40px); }
.cn b { font-size: clamp(1.1rem, 4vw, 1.6rem); font-weight: 800; color: var(--ink); }
.stage-find .keybox { margin-bottom: 14px; }
.pixel-pal { display: flex; justify-content: center; gap: 12px; margin-bottom: 14px; }
.pixel-color { width: 64px; height: 64px; border-radius: 18px; border: 4px solid rgba(31,42,68,.2); box-shadow: 0 5px 0 rgba(31,42,68,.18); }
.pixel-color.sel { outline: 5px solid var(--ink); outline-offset: 3px; transform: translateY(-3px); }
.pixel-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 3px; width: min(100%, calc(var(--cols) * 54px)); margin: 0 auto; padding: 6px; background: #E3E9F2; border-radius: 14px; }
.px { aspect-ratio: 1; border: 0; border-radius: 6px; background: #fff; font-weight: 800; font-size: clamp(.9rem, 3.4vw, 1.3rem); color: #5B6782; display: grid; place-items: center; padding: 0; transition: background .15s, transform .15s; }
.px.blank { background: #fff; opacity: .55; }
.px.on { animation: pop .3s ease; }
.pixel-grid.done { gap: 0; padding: 6px; }
.pixel-grid.done .px { border-radius: 0; }
.pixel-grid.done .px.blank { opacity: 1; }
.cell.trail { background: #FFE9A8; }
.cell.trail.alt { background: #FFE19A; }
.trail-dot { font-size: clamp(1.1rem, 4vw, 1.8rem); opacity: .7; }
.blk.empty { background: #fff; color: #A0AEC0; border: 3px dashed #C4D0E0; box-shadow: none; font-weight: 800; font-size: 1.3rem; display: grid; place-items: center; }
.blk.empty.next { border-color: var(--tier); border-style: solid; color: var(--tier); }
.stage-route .bee-arrows { justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.stage-route .cmd.bee-btn { width: clamp(72px, 20vw, 100px); height: clamp(72px, 20vw, 100px); border-radius: 24px; }
.bin-target { display: flex; align-items: baseline; justify-content: center; gap: 12px; font-size: 1.4rem; font-weight: 800; color: var(--ink-soft); margin-bottom: 14px; }
.bin-target b { font-size: 3.2rem; color: var(--tier); }
.bin-cards { display: flex; justify-content: center; flex-wrap: wrap; gap: clamp(8px, 2.5vw, 16px); margin-bottom: 14px; }
.bin-card {
  width: clamp(72px, 20vw, 110px); padding: 10px 6px 8px; border-radius: 20px; border: 4px solid #3E475C; background: #3E475C; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 6px 0 #262C3A; transition: background .2s, border-color .2s;
}
.bin-card .bin-lamp { font-size: 2rem; filter: grayscale(1) brightness(.6); transition: filter .2s; }
.bin-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 52px; align-content: center; max-width: 80px; }
.bin-dots i { width: 12px; height: 12px; border-radius: 50%; background: #6B7488; }
.bin-bit { font-size: 1.6rem; font-weight: 800; }
.bin-card.on { background: #FFF6CC; border-color: var(--gold); color: var(--ink); box-shadow: 0 6px 0 #E0B100, 0 0 24px rgba(255,197,49,.6); }
.bin-card.on .bin-lamp { filter: none; }
.bin-card.on .bin-dots i { background: var(--ink); }
.bin-status { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; font-size: 1.15rem; font-weight: 700; color: var(--ink-soft); }
.bin-status b { color: var(--ink); font-size: 1.4rem; }
.bin-code b { letter-spacing: 2px; font-family: ui-monospace, monospace; }

/* ---------- Ahli 3 bagian ---------- */
.brobot { position: absolute; }
.robot-heading {
  position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-start;
  color: #E5484D; font-size: clamp(.8rem, 3vw, 1.2rem); line-height: 1; transition: transform .35s ease; pointer-events: none;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}
.bhome span { font-size: clamp(1.4rem, 5.5vw, 2.3rem); }
.tt-turn { background: #0EA5A0; }
.blk.tt-turn b { font-size: 1.6rem; line-height: 1; }
.cmd.tt-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; height: 78px; }
.cmd.tt-btn svg { width: 46%; height: 46%; }
.cmd.tt-btn b { font-size: 2rem; line-height: 1; }
.cmd.tt-btn small { font-size: .8rem; font-weight: 800; }
.cmdpad:has(.tt-btn) { grid-template-columns: repeat(3, 1fr); }
.mini-board { max-width: calc(var(--cols) * min(96px, calc(48vh / var(--rows)))); margin: 0 auto; }
.tap-cell { cursor: pointer; transition: box-shadow .15s; }
.tap-cell:hover { box-shadow: inset 0 0 0 4px rgba(47,140,240,.55); }
.tap-cell.picked { box-shadow: inset 0 0 0 6px #22B35E; }
.predict-code, .code-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; }
.predict-code { margin: 0 auto 14px; padding: 8px 12px; background: #F6F9FD; border: 3px solid var(--line); border-radius: 16px; max-width: 560px; }
.code-strip .blk { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.choose-opts { display: grid; gap: 10px; max-width: 620px; margin: 14px auto 0; }
.choose-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 18px; border: 3px solid var(--line); background: #fff; box-shadow: 0 4px 0 var(--line); text-align: left; }
.choose-opt .code-strip { flex: 1; justify-content: flex-start; }
.choose-opt small { font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.opt-tag { width: 36px; height: 36px; border-radius: 50%; background: var(--tier); color: #fff; display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.choose-opt.sel { border-color: var(--sel); }
.choose-opt.right { border-color: #22B35E; background: #E7F9EE; }
.choose-opt.wrong { border-color: #E5484D; background: #FDECEA; }
.tok-arrow { display: grid; place-items: center; width: 82%; height: 82%; border-radius: 22%; color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.tok-arrow svg { width: 62%; height: 62%; }
.pal-btn .tok-arrow { width: 100%; height: 100%; }

/* ---------- Master 3 bagian ---------- */
.loop-chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 5px; border-radius: 12px; background: #EDE4FC; border: 2px solid #A98BE5; }
.loop-chip > b { font-size: .85rem; color: #5B2DB5; padding: 0 3px; white-space: nowrap; }
.loop-chip .blk { width: 30px; height: 30px; }
.bug-code .blk { cursor: pointer; border: 0; }
.bug-code .blk:hover { transform: translateY(-2px); }
.bug-code .blk.fixed { outline: 4px solid #22B35E; outline-offset: 2px; }
.if-rule { max-width: 520px; margin: 16px auto 10px; padding: 12px 16px; background: #F6F9FD; border: 3px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; gap: 8px; font-weight: 700; }
.if-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.if-kw { font-weight: 800; color: #fff; background: #8E5BE0; padding: 2px 10px; border-radius: 8px; font-size: .9rem; }
.if-kw.if { background: #F08A24; } .if-kw.then { background: #2F8CF0; } .if-kw.else { background: #64748B; }
.if-opts { display: flex; gap: 10px; }
.if-opt { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font-weight: 800; box-shadow: 0 4px 0 var(--line); }
.if-opt b { font-size: 1.6rem; color: #0EA5A0; }
.if-opt.sel { border-color: #0EA5A0; background: #E0F7F5; }
.if-run { display: block; margin: 8px auto 0; min-width: 220px; }
.fn-blk { background: #D9468F; }
.blk.fn-blk b, .func-body .fn-blk b { font-size: 1.5rem; font-style: italic; }
.cmd.fnbtn { background: #D9468F; padding: 0 14px; font-size: 1.6rem; display: flex; flex-direction: column; line-height: 1; }
.cmd.fnbtn b { font-style: italic; }
.cmd.fnbtn small { font-size: .85rem; font-weight: 800; }
.cmdpad:has(.fnbtn) { grid-template-columns: repeat(4, 1fr) auto auto; }
.cmdpad:has(.tt-btn):has(.loopbtn) { grid-template-columns: repeat(3, 1fr) auto; }
.func-box { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-radius: 14px; background: #FCE7F3; border: 3px solid #F0A6CB; }
.func-box.editing { border-style: dashed; border-color: #D9468F; }
.func-name { font-weight: 800; color: #9D174D; font-style: italic; }
.func-body { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.func-body .blk { width: 38px; height: 38px; }

/* ---------- modal & menang ---------- */
#modal { display: none; }
#modal.open { display: block; }
.modal-bg { position: fixed; inset: 0; background: rgba(20, 30, 55, .45); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fadeIn .2s; }
.modal-card { background: #fff; border-radius: 30px; padding: 24px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); animation: pop .35s ease; }
.modal-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.win { text-align: center; }
.win-bot { width: 110px; height: 110px; margin: 0 auto; }
.win-bot svg { width: 100%; height: 100%; }
.win h2 { font-size: 2.2rem; margin-top: 6px; }
.win p { font-size: 1.15rem; color: var(--ink-soft); margin: 6px 0 0; }
.win-stars { font-size: 3.6rem; letter-spacing: 6px; line-height: 1.2; }
.win-stars span { color: #D5DCE6; display: inline-block; animation: pop .5s ease both; }
.win-stars span.on { color: var(--gold); text-shadow: 0 3px 0 #D99A00; }
.guide h2 { margin-bottom: 8px; }
.guide h3 { margin: 16px 0 4px; font-size: 1.15rem; }
.guide p, .guide li { color: var(--ink-soft); line-height: 1.45; }
.guide ul { padding-left: 20px; margin: 4px 0; }
.guide-group { margin: 0 0 14px; }
.gg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 2px; font-size: 1.05rem; color: var(--tier); }
.gg-head small { color: var(--ink-soft); font-weight: 700; font-size: .85rem; }
.gg-note { margin: 0 0 8px; font-size: .92rem; color: var(--ink-soft); font-weight: 600; }
.guide-tiers { display: grid; gap: 8px; }
.guide-tier { border-left: 6px solid var(--tier); background: #F6F9FD; border-radius: 12px; padding: 8px 12px; }
.guide-tier p { margin: 2px 0 0; font-size: .95rem; }
.gt-head { font-weight: 800; display: flex; justify-content: space-between; gap: 8px; }
.gt-head small { color: var(--tier); }
.toggle { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--go); }
.guide-actions { margin-top: 12px; }
.voice-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.voice-row select {
  flex: 1; min-width: 0; font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.voice-hint { font-size: .9rem; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

/* ---------- layar kecil ---------- */
@media (max-width: 560px) {
  .kb-end .lbl { display: none; }
  .kb-end { padding: 10px 8px; }
  .kb-slot { width: 58px; height: 58px; font-size: 34px; }
  .tier-grid { grid-template-columns: 1fr; }
  .group-head { flex-wrap: wrap; gap: 10px; }
  .gh-emoji { width: 38px; height: 38px; font-size: 1.35rem; border-radius: 12px; }
  .gh-name { font-size: 1.15rem; }
  .group-note { font-size: .9rem; }
  .tc-emoji { width: 66px; height: 66px; font-size: 2.4rem; }
  .tc-name { font-size: 1.45rem; }
  .tier-nav .btn { font-size: .95rem; padding: 10px 14px; }
  .stage { padding: 12px; }
  .coach-bot { width: 54px; height: 54px; }
  .pslot { border-width: 2px; border-radius: 8px; }
  .prow { border-radius: 18px; }
  .pal-btn { width: 66px; height: 66px; }
  .levels { grid-template-columns: repeat(2, 1fr); }
  .mcol { gap: 10px; }
  .mcard { padding: 6px; gap: 6px; border-radius: 14px; }
  .mdot { width: 14px; height: 14px; }
  .match { grid-template-columns: 1fr 26px 1fr; }
  .blk { width: 42px; height: 42px; }
  .cmd { height: 58px; }
  .tier-score { display: none; }
  .topbar { gap: 6px; }
  .icon-btn { width: 42px; height: 42px; font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- tingkat 5 · kura-kura menggambar ---------- */
.turtle-canvas {
  width: 100%; max-width: 420px; aspect-ratio: 1; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 3px solid var(--line);
}
.tc-guide line { stroke: #C9D6E8; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 2 14; }
.tc-ink line {
  stroke: var(--tier); stroke-width: 6; stroke-linecap: round;
  animation: inkdraw .22s ease-out;
}
.tc-ink.done line { stroke: var(--go); }
@keyframes inkdraw { from { opacity: .25; } to { opacity: 1; } }
.tc-turtle { transition: transform .18s linear; }
.tprog {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px;
  min-height: 108px; max-height: 240px; overflow-y: auto;
}
.tblk, .tcmd {
  border: 0; border-radius: 12px; font-family: var(--font); font-weight: 800; font-size: 1rem;
  padding: 10px 14px; color: #fff; cursor: pointer; line-height: 1.1;
}
.tblk { box-shadow: 0 3px 0 rgba(31, 42, 68, .22); }
.tcmd { box-shadow: 0 4px 0 rgba(31, 42, 68, .22); padding: 12px 10px; font-size: .98rem; }
.tcmd:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(31, 42, 68, .22); }
.tb-fwd { background: #2F8CF0; }
.tb-turn { background: #F08A24; }
.tb-var { background: #14A39A; }
.tb-fn { background: #E8559B; }
.tb-loop { background: #8E5BE0; }
.tblk.running { box-shadow: 0 0 0 5px #FFD54A; transform: scale(1.06); }
.tpad { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 8px; }
.tvars {
  align-self: flex-start; background: #E3F6F4; border: 2px solid #14A39A; color: #0C6E68;
  font-weight: 800; font-size: 1.1rem; border-radius: 999px; padding: 4px 16px;
}
.tvars .tv-val { display: inline-block; min-width: 2ch; }
.tfunc { font-size: .98rem; }

/* ---------- tingkat 5 · baca kode teks ---------- */
.ct-code {
  background: #202A3D; color: #E8F0FF; border-radius: var(--radius); padding: 14px 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 1.02rem;
  line-height: 1.55; box-shadow: var(--shadow); max-width: 560px; margin: 0 auto 14px; width: 100%;
}
.ct-line { display: flex; gap: 12px; align-items: baseline; }
.ct-line i { font-style: normal; color: #6D7E9B; font-size: .85rem; min-width: 1.4em; text-align: right; }
.ct-line code { white-space: pre; }
.ct-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto; width: 100%; }
.ct-opt {
  border: 3px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px 10px;
  font-family: var(--font); font-weight: 800; font-size: 1.3rem; color: var(--ink);
  box-shadow: 0 4px 0 rgba(31, 42, 68, .1); cursor: pointer;
}
.ct-opt:active { transform: translateY(3px); box-shadow: none; }
.ct-opt.right { border-color: var(--go); background: #E6F8ED; color: var(--go-dark); }
.ct-opt.wrong { border-color: var(--danger); background: #FDECEC; }
@media (max-width: 560px) {
  .tblk, .tcmd { font-size: .92rem; padding: 10px 8px; }
  .tpad { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
  .ct-code { font-size: .92rem; }
  .ct-opt { font-size: 1.15rem; }
}
