body { background: var(--cream); }
.app-top .wrap { height: 64px; }
.app-top .who { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.av { position: relative; border-radius: 50%; display: inline-grid; place-items: center; overflow: hidden; color: #fff; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av b { font-family: var(--f-head); font-weight: 700; }
.av img + b { display: none; }
#view { min-height: calc(100vh - 64px); padding: 28px 20px 100px; }
.page-h { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h h1 { font-size: clamp(28px, 4vw, 40px); margin: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 700; margin-bottom: 14px; }
.back svg { width: 20px; height: 20px; }

/* Pilih profil */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.kid { background: var(--paper); border-radius: var(--r-l); padding: 24px 18px; text-align: center; text-decoration: none; color: var(--ink); box-shadow: var(--sh-1); border: 2px solid transparent; transition: transform .12s, border-color .12s; display: grid; justify-items: center; gap: 8px; cursor: pointer; }
.kid:hover { transform: translateY(-3px); border-color: var(--teal); }
.kid h3 { margin: 6px 0 0; }
.kid.add { border: 2px dashed var(--line); background: transparent; box-shadow: none; color: var(--ink-2); }
.kid.add .plus { width: 88px; height: 88px; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; }
.kid.add svg { width: 36px; height: 36px; }
.parent-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* Banner langganan */
.sub-banner { display: flex; align-items: center; gap: 16px; background: var(--ink); color: #f3efe6; border-radius: var(--r-l); padding: 18px 22px; margin-bottom: 26px; flex-wrap: wrap; }
.sub-banner b { color: var(--sun); }
.sub-banner .btn { margin-left: auto; }

/* Rumah anak */
.kid-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; background: var(--paper); border-radius: var(--r-l); padding: 20px 24px; box-shadow: var(--sh-1); margin-bottom: 22px; }
.kid-hero h1 { font-size: 30px; margin: 0; }
.statrow { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--cream); border-radius: 14px; padding: 8px 14px; font-weight: 800; display: inline-flex; gap: 8px; align-items: center; }
.stat svg { width: 20px; height: 20px; }
.stat.star { color: #a87400; } .stat.fire { color: #c2410c; } .stat.due { color: var(--teal-d); }
@media (max-width: 640px) { .kid-hero { grid-template-columns: auto 1fr; } .kid-hero .statrow { grid-column: 1 / -1; } }
.lv-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: none; }
.lv-tabs button { flex: none; border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 16px; font-weight: 800; cursor: pointer; }
.lv-tabs button.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.qk { display: flex; align-items: center; gap: 14px; background: var(--paper); border-radius: var(--r-m); padding: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--sh-1); font-weight: 800; border: 2px solid transparent; }
.qk:hover { border-color: var(--teal); }
.qk .qi { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; overflow: hidden; }
.qk .qi img { width: 100%; height: 100%; object-fit: cover; }
.qk .qi img + svg { display: none; }
.qk .qi svg { width: 26px; height: 26px; }
.qk small { display: block; font-weight: 600; color: var(--ink-2); }
@media (max-width: 760px) { .quick { grid-template-columns: 1fr; } }

/* Peta unit (laluan) */
.path { position: relative; display: grid; gap: 18px; max-width: 760px; }
.unit-card { position: relative; display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: center; background: var(--paper); border-radius: var(--r-l); padding: 16px 20px; text-decoration: none; color: var(--ink); box-shadow: var(--sh-1); border: 2px solid transparent; transition: transform .12s, border-color .12s; }
.unit-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.unit-card:nth-child(even) { margin-left: 48px; }
@media (max-width: 640px) { .unit-card:nth-child(even) { margin-left: 18px; } .unit-card { grid-template-columns: 60px 1fr auto; } }
.unit-no { width: 76px; height: 76px; border-radius: 24px; background: var(--teal); color: #fff; display: grid; place-items: center; font-family: var(--f-head); font-weight: 700; font-size: 30px; box-shadow: 0 5px 0 var(--teal-d); }
@media (max-width: 640px) { .unit-no { width: 60px; height: 60px; font-size: 24px; border-radius: 18px; } }
.unit-card.done .unit-no { background: var(--sun); color: var(--ink); box-shadow: 0 5px 0 #d4a11f; }
.unit-card.locked .unit-no { background: #c9ccd4; box-shadow: 0 5px 0 #a8acb6; }
.unit-card h3 { margin: 0; font-size: 20px; }
.unit-card .uar { font-size: 22px; color: var(--teal-d); line-height: 1.5; }
.unit-card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.unit-card .tail svg { width: 26px; height: 26px; color: var(--ink-3); }
.steps-dots { display: flex; gap: 4px; }
.steps-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.steps-dots i.on { background: var(--teal); }
.exam-card { background: var(--ink); color: #f3efe6; }
.exam-card h3 { color: #fff; }
.exam-card .unit-no { background: var(--orange); box-shadow: 0 5px 0 #a3550f; }

/* Pemain unit */
.player { max-width: 860px; margin: 0 auto; }
.step-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; background: var(--paper); padding: 6px; border-radius: 20px; box-shadow: var(--sh-1); margin-bottom: 22px; }
.step-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; text-decoration: none; color: var(--ink-2); font-weight: 800; font-size: 14px; }
.step-nav a svg { width: 22px; height: 22px; }
.step-nav a.on { background: var(--teal); color: #fff; }
.step-nav a.done:not(.on) { color: var(--teal-d); }
.unit-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.unit-title h1 { font-size: 32px; margin: 0; }
.unit-title .ar { font-size: 30px; color: var(--teal-d); }

.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.vcard { background: var(--paper); border-radius: var(--r-m); padding: 10px; box-shadow: var(--sh-1); cursor: pointer; border: 2px solid transparent; text-align: center; transition: transform .1s, border-color .1s; }
.vcard:hover { border-color: var(--teal); transform: translateY(-2px); }
.vcard .ar { font-size: 28px; line-height: 1.6; margin-top: 6px; color: var(--ink); }
.vcard .rumi { font-size: 13px; color: var(--ink-3); font-style: italic; }
.vcard .bm { font-weight: 800; }
.vcard.playing { border-color: var(--orange); }
.note { background: var(--paper); border-radius: var(--r-l); padding: 22px 24px; box-shadow: var(--sh-1); margin: 18px 0; border-left: 6px solid var(--orange); }
.note h3 { margin-bottom: 8px; }
.note .ex { display: flex; justify-content: space-between; gap: 14px; align-items: center; border-top: 1px dashed var(--line); padding: 10px 0; flex-wrap: wrap; }
.note .ex .ar { font-size: 26px; }
.say { border: 0; background: var(--teal-l); color: var(--teal-d); width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.say svg { width: 20px; height: 20px; }
.dialog { display: grid; gap: 10px; }
.bubble { max-width: 80%; background: var(--paper); border-radius: 20px; padding: 10px 16px; box-shadow: var(--sh-1); }
.bubble.b { justify-self: end; background: var(--teal-l); }
.bubble .ar { font-size: 24px; display: block; }
.bubble small { color: var(--ink-2); }
.next-bar { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }

/* Latihan */
.ex-wrap { background: var(--paper); border-radius: var(--r-l); padding: 26px; box-shadow: var(--sh-1); min-height: 340px; }
.ex-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.progress { height: 12px; background: var(--line-2); border-radius: 99px; overflow: hidden; flex: 1; margin-right: 14px; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width .3s; }
.ex-q { font-size: 22px; font-weight: 800; margin-bottom: 18px; }
.ex-q .ar, .ex-q.ar { font-size: 34px; font-weight: 700; display: block; text-align: center; line-height: 1.8; }
.ex-q .ar.long { font-size: 24px; font-weight: 600; text-align: right; line-height: 2; background: var(--cream); border-radius: 16px; padding: 14px 18px; white-space: pre-line; }
.opts { display: grid; gap: 12px; }
.opts.cols { grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .opts.cols { grid-template-columns: 1fr; } }
.opt { min-height: 60px; padding: 12px 18px; border-radius: 18px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 700; font-size: 18px; text-align: left; box-shadow: 0 3px 0 var(--line); transition: transform .06s; }
.opt.arx { font-family: var(--f-ar); font-size: 26px; text-align: center; direction: rtl; }
.opt:hover { border-color: var(--teal); }
.opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt.right { border-color: var(--teal); background: var(--teal-l); color: var(--teal-d); box-shadow: 0 3px 0 var(--teal); animation: pop .3s; }
.opt.wrong { border-color: var(--rose); background: var(--rose-l); color: #9b2c28; box-shadow: 0 3px 0 var(--rose); animation: shake .3s; }
.opt[disabled] { cursor: default; }
.feedback { margin-top: 18px; padding: 14px 18px; border-radius: 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; animation: rise .2s; }
.feedback.good { background: var(--teal-l); color: var(--teal-d); }
.feedback.bad { background: var(--rose-l); color: #9b2c28; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.match .opt.sel { border-color: var(--orange); background: var(--orange-l); }
.match .opt.gone { opacity: .35; pointer-events: none; border-color: var(--teal); }
.tray, .built { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 70px; direction: rtl; padding: 12px; border-radius: 18px; }
.built { background: var(--cream); border: 2px dashed var(--line); margin-bottom: 14px; }
.chip { font-family: var(--f-ar); font-size: 24px; font-weight: 700; padding: 6px 16px; border-radius: 14px; background: var(--paper); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); cursor: pointer; }
.chip.used { visibility: hidden; }
.listen-btn { width: 110px; height: 110px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: grid; place-items: center; margin: 0 auto 20px; cursor: pointer; box-shadow: 0 6px 0 #a3550f; }
.listen-btn svg { width: 48px; height: 48px; }
.result { text-align: center; padding: 20px 0; }
.result .big { font-family: var(--f-head); font-size: 72px; font-weight: 700; color: var(--teal); line-height: 1; }
.result .stars { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
.result .stars svg { width: 48px; height: 48px; color: var(--line); }
.result .stars svg.on { color: var(--sun); fill: var(--sun); animation: pop .4s both; }
.result .stars svg.on:nth-child(2) { animation-delay: .15s; } .result .stars svg.on:nth-child(3) { animation-delay: .3s; }

/* Tulis + AI */
.write-box .model { background: var(--cream); border-radius: 16px; padding: 14px 18px; margin-top: 14px; }
.ai-out { margin-top: 16px; border-radius: 18px; padding: 16px 20px; background: var(--sky); }
.ai-out .score { font-family: var(--f-head); font-weight: 700; font-size: 32px; color: #2b5c9e; }
.kbd { display: flex; flex-wrap: wrap; gap: 6px; direction: rtl; margin-top: 10px; }
.kbd button { min-width: 40px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-family: var(--f-ar); font-size: 22px; cursor: pointer; }
.kbd button.w { min-width: 90px; font-family: var(--f-body); font-size: 14px; font-weight: 700; }

/* Games */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.game-card { border: 0; text-align: left; background: var(--paper); border-radius: var(--r-l); overflow: hidden; box-shadow: var(--sh-1); cursor: pointer; padding: 0; border: 2px solid transparent; }
.game-card:hover { border-color: var(--teal); }
.game-card .gimg { aspect-ratio: 16/10; background: linear-gradient(150deg, var(--teal), #0b5c4b); display: grid; place-items: center; color: #fff; overflow: hidden; }
.game-card:nth-child(2) .gimg { background: linear-gradient(150deg, var(--orange), #b45a10); }
.game-card:nth-child(3) .gimg { background: linear-gradient(150deg, #2b5c9e, #1c3f70); }
.game-card:nth-child(4) .gimg { background: linear-gradient(150deg, #7a5bc2, #523a92); }
.game-card .gimg img { width: 100%; height: 100%; object-fit: cover; }
.game-card .gimg img + span { display: none; }
.game-card .gimg span { font-family: var(--f-ar); font-size: 48px; }
.game-card div.t { padding: 14px 16px; }
.game-card h3 { margin: 0 0 2px; font-size: 19px; }
.game-stage { background: linear-gradient(180deg, #e9f5f0, #fdf6e6); border-radius: var(--r-l); padding: 20px; min-height: 420px; position: relative; overflow: hidden; box-shadow: var(--sh-1); }
.ghud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-weight: 800; gap: 10px; flex-wrap: wrap; }
.ghud .stat { background: rgba(255,255,255,.8); }
.mem { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; perspective: 900px; }
@media (max-width: 560px) { .mem { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mcard { aspect-ratio: 3/4; position: relative; cursor: pointer; transform-style: preserve-3d; transition: transform .4s; }
.mcard.flip, .mcard.got { transform: rotateY(180deg); }
.mcard > div { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; display: grid; place-items: center; box-shadow: 0 6px 14px rgba(31,42,68,.14); }
.mcard .back { background: linear-gradient(150deg, var(--teal), #0b5c4b); color: rgba(255,255,255,.85); font-family: var(--f-ar); font-size: 44px; }
.mcard .front { background: #fff; transform: rotateY(180deg); padding: 8px; text-align: center; }
.mcard .front .ar { font-size: 26px; }
.mcard .front .vimg { width: 100%; aspect-ratio: 1; }
.mcard.got .front { box-shadow: 0 0 0 4px var(--sun), 0 6px 14px rgba(31,42,68,.14); }
.train { display: flex; gap: 6px; justify-content: center; direction: rtl; margin: 10px 0 18px; flex-wrap: wrap; }
.wagon { min-width: 64px; height: 72px; border-radius: 14px 14px 8px 8px; background: #fff; border: 3px solid var(--teal); display: grid; place-items: center; font-family: var(--f-ar); font-size: 34px; font-weight: 700; position: relative; }
.wagon::after { content: ""; position: absolute; bottom: -12px; left: 10px; right: 10px; height: 12px; background: radial-gradient(circle, #1f2a44 5px, transparent 6px) 0 0/22px 12px repeat-x; }
.wagon.empty { border-style: dashed; color: transparent; }
.wagon.engine { background: var(--orange); border-color: #a3550f; color: #fff; font-size: 18px; font-family: var(--f-head); }
.market { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .market { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stall { background: #fff; border-radius: 18px; padding: 8px; cursor: pointer; border: 3px solid transparent; box-shadow: 0 6px 0 #e3d6bb; transition: transform .08s; }
.stall:active { transform: translateY(3px); box-shadow: 0 3px 0 #e3d6bb; }
.stall.right { border-color: var(--teal); } .stall.wrong { border-color: var(--rose); animation: shake .3s; }
.stall .p { text-align: center; font-weight: 800; color: #8a6100; }
.timer { height: 10px; background: rgba(255,255,255,.7); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.timer i { display: block; height: 100%; background: var(--orange); transition: width .2s linear; }
.combo { position: absolute; right: 20px; top: 60px; font-family: var(--f-head); font-size: 28px; color: var(--orange); animation: pop .3s; }

/* Ibu bapa */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pcard .row { display: flex; align-items: center; gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.kpi { background: var(--cream); border-radius: 14px; padding: 10px; text-align: center; }
.kpi b { display: block; font-family: var(--f-head); font-size: 24px; color: var(--teal-d); }
.kpi span { font-size: 12px; font-weight: 800; color: var(--ink-2); }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.bars7 { display: flex; gap: 8px; align-items: flex-end; height: 110px; padding-top: 10px; }
.bars7 div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars7 i { width: 100%; max-width: 34px; background: var(--teal); border-radius: 8px 8px 4px 4px; min-height: 3px; }
.bars7 small { font-size: 12px; color: var(--ink-2); font-weight: 700; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th, table.t td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t th { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.tp { display: inline-grid; place-items: center; min-width: 44px; height: 28px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.tp1, .tp2 { background: var(--rose-l); color: #9b2c28; } .tp3, .tp4 { background: var(--sun-l); color: #8a6100; } .tp5, .tp6 { background: var(--teal-l); color: var(--teal-d); }
.bar { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--teal); }

/* Bar bawah telefon */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--paper); border-top: 1px solid var(--line-2); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; text-decoration: none; color: var(--ink-3); font-weight: 800; font-size: 12px; }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.on { color: var(--teal); }
  .app-top .nav { display: none; }
}
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

.passage { background: var(--cream); border-radius: 16px; padding: 4px 18px 10px; margin-bottom: 16px; border: 0; }
.passage summary { padding: 10px 0; font-weight: 800; cursor: pointer; }
.passage .ar { font-size: 22px; line-height: 2.1; text-align: right; white-space: pre-line; font-weight: 500; }
