/* Baloo 2 (SIL OFL 1.1, lihat assets/fonts/OFL.txt), disimpan sendiri supaya tidak menunggu Google Fonts.
   Satu file variable font subset latin untuk semua ketebalan. */
@font-face{
  font-family:"Baloo 2"; font-style:normal; font-weight:400 800; font-display:swap;
  src:url("../fonts/baloo2-latin-v23.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;
}
[hidden]{ display:none !important; }
#play:focus{ outline:none; }   /* fokus dipindah ke sini saat main, tanpa garis fokus */
:root{
  --bg:#FFF3C4; --card:#FFFDF7; --text:#1B2A6B; --muted:#3F5A92;
  --accent:#FFD23F; --sun:#FFD23F; --water:#47C9E5; --leaf:#7BD88F; --soap:#FF8FB1; --btn-ink:#1B2A6B;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#103A62; --card:#1B4D7E; --text:#FFFDF7; --muted:#BFE3F5; }
}
*,*::before,*::after{ box-sizing:border-box; }
html{ height:100%; }
body{
  margin:0; height:100%; background:var(--bg); color:var(--text);
  font-family:"Baloo 2","Trebuchet MS","Segoe UI Rounded",system-ui,sans-serif;
  -webkit-tap-highlight-color:transparent; overflow:hidden;
}
button{ font:inherit; cursor:pointer; }
button:focus-visible, a:focus-visible{ outline:4px solid var(--sun); outline-offset:3px; }

/* ---------- Home ---------- */
#home{
  height:100%; overflow-y:auto; display:flex; flex-direction:column; align-items:center; text-align:center;
  padding:calc(env(safe-area-inset-top,0px) + 24px) 20px calc(env(safe-area-inset-bottom,0px) + 24px);
}
.mascot{ width:clamp(150px, 46vw, 220px); margin-top:8px; animation:bob 2.6s ease-in-out infinite; }
.mascot svg{ display:block; width:100%; height:auto; }
@keyframes bob{ 50%{ transform:translateY(-10px) rotate(4deg); } }
h1{
  font-size:clamp(2.6rem, 11vw, 4rem); line-height:.95; margin:8px 0 8px; font-weight:800;
  text-shadow:0 4px 0 rgba(255,255,255,.65);
}
@media (prefers-color-scheme: dark){ :root h1{ text-shadow:0 4px 0 rgba(0,0,0,.25); } }
.lead{ font-size:1.25rem; line-height:1.35; color:var(--muted); max-width:22em; margin:0 0 22px; font-weight:500; }
.stars{
  margin-top:22px; background:var(--card); border-radius:999px; padding:8px 20px;
  font-size:1.2rem; font-weight:700; box-shadow:0 4px 0 rgba(27,42,107,.15);
}
.back{ margin:auto 0 0; padding-top:24px; font-size:1.05rem; }
.back a, .credit a{ color:var(--text); font-weight:700; }/* ---------- Play ---------- */
#play{
  position:fixed; inset:0; background:var(--bg); display:none; flex-direction:column; touch-action:manipulation;
  padding-bottom:calc(env(safe-area-inset-bottom,0px) + 16px); user-select:none; -webkit-user-select:none;
}
#play.on{ display:flex; }
.hud{
  flex:none; display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:calc(env(safe-area-inset-top,0px) + 12px) calc(env(safe-area-inset-right,0px) + 14px) 0 calc(env(safe-area-inset-left,0px) + 14px);
}
.round{
  width:56px; height:56px; border-radius:50%; border:0; background:var(--card); color:var(--text);
  font-size:1.7rem; box-shadow:0 4px 0 rgba(0,0,0,.2); display:grid; place-items:center; flex:none;
}
.round:disabled{ opacity:.45; }
.counter{ display:flex; gap:8px; background:var(--card); border-radius:999px; padding:6px 10px; box-shadow:0 4px 0 rgba(0,0,0,.2); }
.counter .need{ width:40px; height:40px; border-radius:50%; display:grid; place-items:center; background:rgba(27,42,107,.08); position:relative; }
.counter .need svg{ width:28px; height:28px; opacity:.35; filter:grayscale(1); transition:opacity .3s, filter .3s; }
.counter .need.now{ background:rgba(255,210,63,.45); }
.counter .need.now svg{ opacity:1; filter:none; }
.counter .need.done{ background:var(--leaf); }
.counter .need.done svg{ opacity:1; filter:none; }
.counter .need.done::after{
  content:"✓"; position:absolute; right:-4px; bottom:-4px; width:20px; height:20px; border-radius:50%;
  background:#fff; color:#2E8B57; font-size:.85rem; font-weight:800; display:grid; place-items:center; line-height:1;
}

.talk{ flex:none; display:flex; justify-content:center; padding:14px 18px 0; min-height:72px; }
.bubble{
  position:relative; background:var(--card); color:var(--text); border-radius:26px; padding:10px 20px 12px;
  max-width:min(92vw, 460px); text-align:center; font-size:1.4rem; font-weight:800; line-height:1.2;
  box-shadow:0 5px 0 rgba(0,0,0,.15); align-self:flex-start;
}
.bubble:empty{ visibility:hidden; }
.bubble::after{
  content:""; position:absolute; left:50%; bottom:-11px; width:22px; height:22px; margin-left:-11px;
  background:var(--card); transform:rotate(45deg); border-radius:4px;
}
.bubble.pop{ animation:pop .35s ease-out; }
@keyframes pop{ 0%{ transform:scale(.9); } 60%{ transform:scale(1.04); } }

.stage{ flex:1 1 auto; min-height:0; display:flex; align-items:center; justify-content:center; padding:14px 12px 6px; }
.rev-wrap{ position:relative; height:100%; max-height:420px; max-width:88vw; aspect-ratio:320/360; }
#rev, #rev svg{ display:block; width:100%; height:100%; }
.hit{ position:absolute; border:0; background:transparent; border-radius:50%; padding:0; }
.hit:focus-visible{ outline-offset:-4px; }
.hit.head{ left:17%; top:12%; width:66%; height:50%; }
.hit.belly{ left:26%; top:62%; width:48%; height:32%; border-radius:40%; }

/* Mulut bicara: game menyalakan/mematikan .yap bergantian */
.mouth-talk{ display:none; }
.yap .mouth{ display:none; }
.yap .mouth-talk{ display:inline; }
.eyes{ transform-box:fill-box; transform-origin:center; }
.blink .eyes{ animation:blink .2s ease-in-out; }
@keyframes blink{ 50%{ transform:scaleY(.1); } }
.tail{ transform-box:fill-box; transform-origin:0% 92%; animation:wag 1.8s ease-in-out infinite alternate; }
@keyframes wag{ from{ transform:rotate(-5deg); } to{ transform:rotate(8deg); } }
.growl{ animation:growl .5s ease-in-out infinite alternate; }
@keyframes growl{ to{ opacity:.15; } }
.zzz text{ animation:zzz 2s ease-in-out infinite; }
.zzz text:nth-child(2){ animation-delay:.3s; } .zzz text:nth-child(3){ animation-delay:.6s; }
@keyframes zzz{ 50%{ transform:translateY(-6px); opacity:.6; } }
.sparkle path{ transform-box:fill-box; transform-origin:center; animation:twinkle 1s ease-in-out infinite alternate; }
@keyframes twinkle{ to{ transform:scale(.6) rotate(20deg); } }
.think{ animation:think 2s ease-in-out infinite; }
@keyframes think{ 50%{ transform:translate(12px,-18px); } }

.rev-wrap.no #rev{ animation:no .55s ease-in-out; transform-origin:50% 90%; }
@keyframes no{ 20%{ transform:rotate(-5deg); } 50%{ transform:rotate(5deg); } 80%{ transform:rotate(-3deg); } }
.rev-wrap.boing #rev{ animation:squash .45s ease-out; transform-origin:50% 100%; }
@keyframes squash{ 30%{ transform:scale(1.06,.9); } 65%{ transform:scale(.97,1.04); } }
.rev-wrap.giggle #rev{ animation:giggle .4s ease-in-out 3; transform-origin:50% 100%; }
@keyframes giggle{ 25%{ transform:rotate(-4deg); } 75%{ transform:rotate(4deg); } }
.rev-wrap.cheer #rev{ animation:cheer .5s ease-out 2; transform-origin:50% 100%; }
@keyframes cheer{ 40%{ transform:translateY(-24px); } }
.rev-wrap.chew #rev{ animation:chew .3s ease-in-out infinite alternate; transform-origin:50% 100%; }
@keyframes chew{ to{ transform:scale(1.02,.98); } }

/* Bar bawah: benda untuk Rev / mikrofon */
.bar{ flex:none; display:none; padding:0 calc(env(safe-area-inset-right,0px) + 16px) 0 calc(env(safe-area-inset-left,0px) + 16px); }
#play:not(.listen) .tray, #play.listen .listen{ display:grid; }
.tray{ grid-auto-flow:column; grid-auto-columns:minmax(0, 1fr); gap:12px; width:100%; max-width:520px; margin:0 auto; }
.tray.single{ grid-auto-flow:row; justify-items:center; gap:8px; }
.tray.single .item{ width:min(100%, 260px); }
.tray .step{ grid-column:1 / -1; text-align:center; font-size:1.2rem; font-weight:800; color:var(--muted); margin:-4px 0 -2px; }
.item{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; border:0; border-radius:26px;
  padding:8px 4px 6px; min-height:104px; background:var(--card); color:var(--text); font-size:1.15rem; font-weight:800;
  box-shadow:0 6px 0 rgba(27,42,107,.2); transition:opacity .2s;
}
.item svg{ width:60px; height:60px; display:block; }
.item:active{ transform:translateY(4px); box-shadow:0 2px 0 rgba(27,42,107,.2); }
.item.makan{ background:#DDF0FF; } .item.minum{ background:#D8F6FA; } .item.obat{ background:#EEE3FF; }
.item.used{ opacity:.45; }
.item.nudge{ animation:nudge .8s ease-in-out infinite; outline:4px solid var(--sun); outline-offset:3px; }
@keyframes nudge{ 50%{ transform:translateY(-8px) rotate(-3deg); } }
.item.shake svg{ animation:bottle .35s ease-in-out; }
@keyframes bottle{ 25%{ transform:rotate(-24deg); } 75%{ transform:rotate(24deg); } }
.tray .dots{ display:flex; gap:6px; justify-content:center; }
.tray .dots i{ width:12px; height:12px; border-radius:50%; background:rgba(27,42,107,.2); }
.tray .dots i.on{ background:#8A4FD8; }
@media (prefers-color-scheme: dark){
  .item.makan{ background:#2A5F8F; } .item.minum{ background:#1F6377; } .item.obat{ background:#4B3D85; }
  .tray .dots i{ background:rgba(255,255,255,.25); } .tray .dots i.on{ background:#C9A8FF; }
  .counter .need{ background:rgba(255,255,255,.1); }
}
.fly{ position:fixed; left:0; top:0; width:64px; height:64px; pointer-events:none; z-index:5; }
.fly svg{ width:100%; height:100%; display:block; }

.listen{ justify-items:center; gap:6px; }
.level{ display:flex; align-items:center; gap:6px; height:36px; }
.level i{ width:8px; height:8px; border-radius:4px; background:var(--text); transition:height .08s; }
.micbig{
  width:96px; height:96px; border-radius:50%; border:0; background:var(--leaf); font-size:2.6rem;
  box-shadow:0 0 0 12px rgba(123,216,143,.35); margin:8px 0;
  animation:pulse 1.4s ease-in-out infinite;
}
.micbig:active{ transform:translateY(3px); }
@keyframes pulse{ 50%{ box-shadow:0 0 0 20px rgba(123,216,143,.2); } }
.hint{ font-size:1.1rem; font-weight:700; color:var(--muted); text-align:center; }

.sheet{
  position:absolute; inset:0; display:none; align-items:center; justify-content:center; padding:24px;
  background:rgba(14,45,77,.55);
}
.sheet.on{ display:flex; }
.panel{
  background:var(--card); color:var(--text); border-radius:32px; padding:22px 22px 22px; text-align:center;
  width:min(100%, 400px); box-shadow:0 10px 0 rgba(0,0,0,.2);
}
.win-rev{ width:170px; margin:-90px auto 0; }
.win-rev svg{ display:block; width:100%; height:auto; }
.panel h2{ font-size:2.2rem; line-height:1.05; margin:4px 0 6px; font-weight:800; }
.panel p{ font-size:1.15rem; margin:0 0 14px; color:var(--muted); line-height:1.35; }
.btn{
  display:block; width:100%; border:0; border-radius:20px; padding:12px; margin-top:10px;
  font-size:1.35rem; font-weight:800; color:var(--btn-ink); background:var(--accent);
  box-shadow:0 5px 0 rgba(27,42,107,.25);
}
.btn.big{ width:auto; min-width:220px; padding:14px 40px; font-size:1.8rem; border-radius:999px; }
.btn.alt{ background:var(--water); }
.btn:active{ transform:translateY(4px); box-shadow:0 1px 0 rgba(27,42,107,.25); }

/* Layar pendek (HP landscape / HP kecil) */
@media (max-height:620px){
  .talk{ padding-top:8px; min-height:60px; }
  .bubble{ font-size:1.15rem; padding:8px 16px; }
  .item{ min-height:80px; flex-direction:row; gap:6px; }
  .item svg{ width:44px; height:44px; }
  .micbig{ width:76px; height:76px; font-size:2rem; }
  .level, .hint{ display:none; }
}

sform:translateY(4px); box-shadow:0 1px 0 rgba(27,42,107,.25); }

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{ animation:none !important; transition:none !important; }
}
