/* =====================================================================
   ANIMAL EXPLORER – giao diện (màu sắc, cỡ chữ, bố cục)
   Ưu tiên điện thoại dọc; máy tính bảng/máy tính tự giãn rộng.
   ===================================================================== */
:root{
  --bg1:#e6f6ff; --bg2:#fff6e2;
  --ink:#2f3a45; --ink2:#6b7682; --line:#e5e1d8;
  --orange:#ff8a3d; --green:#43b86a; --blue:#3fa3e8; --yellow:#ffc93c; --red:#ef6b6b;
  --card:#fff; --shadow:0 4px 14px rgba(40,60,80,.12); --r:22px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0}
body{font-family:"Nunito","Baloo 2","Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;color:var(--ink);font-size:18px;
  background:linear-gradient(180deg,var(--bg1),var(--bg2)) fixed;min-height:100vh;min-height:100dvh}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}
img.em{height:1.15em;width:1.15em;vertical-align:-.2em;display:inline-block}
small{font-size:.7em;opacity:.8}

/* song ngữ: tiếng Việt nhỏ, nhạt, nằm dưới */
.bi{display:inline-block}
.bi .en{display:block}
.vi{display:none}
body.vi-on .vi{display:block;font-size:.66em;font-weight:600;opacity:.72;margin-top:2px;line-height:1.25}

/* thanh trên cùng */
.top{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:6px;padding:8px 10px;
  background:rgba(255,255,255,.85);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);box-shadow:0 2px 8px rgba(0,0,0,.06)}
.top .ttl{flex:1;text-align:center;font-weight:800;font-size:19px;line-height:1.15}
.top .ttl .vi{font-size:.7em}
.pill{border:0;background:#fff;border-radius:999px;padding:8px 12px;font-weight:800;font-size:15px;box-shadow:var(--shadow);
  display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:var(--ink);position:relative;overflow:hidden}
.pill.icon{width:44px;height:44px;justify-content:center;padding:0}
.pill-space{width:44px}
.pill.on{background:#fff3e6}
.pill.off{opacity:.6}
.pill.danger{background:#ffe3e3;color:#b42318}
.hold .fill{position:absolute;left:0;top:0;bottom:0;width:0;background:rgba(255,138,61,.25)}

#wbg{position:fixed;inset:0;z-index:0;pointer-events:none;background:center bottom/cover no-repeat;display:none}
body.has-world #wbg{display:block}
body.has-world main{position:relative;z-index:1}
body.has-world .hint{background:rgba(255,255,255,.8);border-radius:14px;padding:6px 10px;display:table;margin:6px auto 12px}
main{max-width:880px;margin:0 auto;padding:12px 14px 28px}
.hint{text-align:center;font-weight:700;color:var(--ink2);margin:6px 0 12px}
.card{background:#fff;border-radius:var(--r);padding:16px;box-shadow:var(--shadow)}

/* nút lớn */
.btn{border:0;border-radius:20px;padding:14px 18px;font-weight:900;font-size:20px;background:var(--orange);color:#fff;
  box-shadow:0 5px 0 rgba(0,0,0,.14);display:flex;align-items:center;justify-content:center;gap:10px;width:100%;text-align:left;line-height:1.15}
.btn:active{transform:translateY(3px);box-shadow:0 2px 0 rgba(0,0,0,.14)}
.btn.big{font-size:23px;padding:17px 20px}
.btn.green{background:var(--green)}
.btn.blue{background:var(--blue)}
.btn.yellow{background:var(--yellow);color:#5b4300}
.btn.ghost{background:#fff;color:var(--ink)}
.btn img.em{height:1.3em;width:1.3em}
.btn .vi{opacity:.9}
.stack{display:flex;flex-direction:column;gap:12px;max-width:460px;margin:0 auto}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.row2 .btn{font-size:17px;padding:12px;flex-direction:column;text-align:center;gap:4px}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.row.c{justify-content:center}

/* trang chủ */
.home{text-align:center;padding-top:4px}
.guide{display:flex;justify-content:center}
.guide img,.guide .emo{width:120px;height:120px;object-fit:contain}
.guide .emo img.em{width:84px;height:84px;margin-top:18px}
.guide.big img{width:150px;height:150px}
.logo{font-size:40px;margin:2px 0 0;font-weight:900;letter-spacing:.5px;color:#2b6cb0;
  text-shadow:0 3px 0 #fff,0 5px 0 rgba(0,0,0,.08)}
.tag{margin:2px 0 8px;font-weight:800;color:var(--ink2)}
.parade{display:flex;justify-content:center;gap:12px;margin:6px 0 16px}
.parade span{animation:hop 1.6s ease-in-out infinite}
.parade img.em{width:48px;height:48px}
.parade .pic{width:72px}
@keyframes hop{0%,100%{transform:translateY(0)}40%{transform:translateY(-10px)}}

.foot{text-align:center;color:var(--ink2);font-size:14px;margin-top:26px;display:flex;flex-direction:column;gap:10px;align-items:center}
.foot .pill{font-size:14px}

/* chọn thế giới */
.worlds{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.world{position:relative;border:0;border-radius:var(--r);min-height:170px;padding:14px 10px;overflow:hidden;
  background:linear-gradient(160deg,#fff 0%,var(--wc) 120%);box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:4px}
.world .wbg{position:absolute;inset:0;z-index:0}
.world .wbg img{width:100%;height:100%;object-fit:cover}
.world .wbg .emo{display:none}
.world>*:not(.wbg){position:relative;z-index:1}
.world .wemo img.em{width:64px;height:64px}
.world .wemo .pic{width:96px;filter:drop-shadow(0 3px 4px rgba(0,0,0,.25))}
.world .wbg::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.35))}
.world .wname{font-weight:900;font-size:20px;background:rgba(255,255,255,.85);border-radius:12px;padding:4px 10px}
.world .wstat{font-weight:800;font-size:14px;background:rgba(255,255,255,.85);border-radius:999px;padding:3px 10px}
.world.soon{filter:saturate(.45)}
.world.soon .wemo{opacity:.6}

/* các con vật trong thế giới */
.agrid,.pgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.acard,.pcard{position:relative;border:0;background:#fff;border-radius:18px;padding:8px 6px 10px;box-shadow:var(--shadow);text-align:center}
.aname{display:block;font-weight:900;font-size:17px;margin-top:4px}
.tick{position:absolute;top:6px;right:6px}
.pic{width:100%;aspect-ratio:1/1;display:flex;align-items:center;justify-content:center}
.pic img{width:100%;height:100%;object-fit:contain}
.pic .emo{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.pic .emo img.em{width:68%;height:68%}
.pic.xl{max-width:240px;margin:0 auto}
.pic.sm{width:58px}
.pcard.locked{background:#f1eee8;box-shadow:none}
.pcard.locked .pic img{opacity:.35}
.pcard.locked .aname{color:#b9b1a3}
.wtitle{margin:18px 0 8px;font-size:19px;border-left:8px solid var(--wc);padding-left:8px;display:flex;align-items:center;gap:8px}
.wtitle small{margin-left:auto}

.playbox{margin-top:18px;display:flex;flex-direction:column;gap:12px;max-width:520px;margin-left:auto;margin-right:auto}
.lvl{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.lv{border:3px solid transparent;background:#fff;border-radius:16px;padding:8px 4px;box-shadow:var(--shadow);font-weight:800;font-size:14px;line-height:1.15}
.lv.on{border-color:var(--orange);background:#fff3e6}
.lvi img.em{width:30px;height:30px}
.lvn{display:block}

/* màn chơi */
.progress{display:flex;align-items:center;justify-content:center;gap:8px;margin:4px 0 12px}
.dot{width:16px;height:16px;border-radius:50%;background:#dcd6cb}
.dot.done{background:var(--green)}
.dot.now{background:var(--orange);transform:scale(1.25)}
.pnum{font-weight:900;margin-left:6px;color:var(--ink2)}
.qbox{display:flex;align-items:center;gap:10px;background:#fff;border-radius:var(--r);padding:14px 14px;box-shadow:var(--shadow);margin-bottom:14px}
.qtext{flex:1;font-size:27px;font-weight:900;line-height:1.2}
.speak{border:0;background:#e8f4ff;border-radius:50%;width:48px;height:48px;flex:none;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}
.speak.big{width:60px;height:60px}
.speak.big img.em{width:30px;height:30px}
.speak.sm{width:38px;height:38px}
.speak.playing{background:#ffe1c7;animation:pulse 1s infinite}
@keyframes pulse{50%{transform:scale(1.08)}}
.opts{display:grid;gap:12px;max-width:620px;margin:0 auto}
.opts.n2{grid-template-columns:1fr 1fr}
.opts.n3{grid-template-columns:1fr 1fr 1fr}
.opts.n4{grid-template-columns:1fr 1fr}
.opt{border:4px solid #fff;background:#fff;border-radius:24px;padding:10px;box-shadow:var(--shadow);transition:transform .15s}
.opt:active{transform:scale(.96)}
.opt.good{border-color:var(--green);background:#e9f9ee;animation:yay .5s}
.opt.bad{opacity:.4;animation:shake .4s;cursor:default}
@keyframes yay{50%{transform:scale(1.08)}}
@keyframes shake{20%,60%{transform:translateX(-7px)}40%,80%{transform:translateX(7px)}}
.fb{min-height:64px;text-align:center;font-weight:900;font-size:20px;margin-top:12px}
.fb>div{display:flex;align-items:center;justify-content:center;gap:8px}
.fb img.em{width:34px;height:34px}
.guide.mini img,.guide.mini .emo{width:56px;height:56px}
.guide.mini .emo img.em{width:40px;height:40px;margin-top:8px}
.fb .ok{color:#1f7a42}
.fb .try{color:#a35a1a}

/* thẻ kiến thức */
.fact{text-align:center}
.lead{font-weight:900;color:#1f7a42;font-size:20px}
.fname{font-size:32px;font-weight:900;display:flex;align-items:center;justify-content:center;gap:10px;margin:4px 0}
.fline{font-size:21px;font-weight:800;display:flex;align-items:center;justify-content:center;gap:8px;margin:6px 0}
.dyk{background:#fff8dc;border-radius:16px;padding:10px 12px;margin:10px 0;font-size:18px;font-weight:700;display:flex;flex-direction:column;align-items:center;gap:4px}
.newcard{text-align:center;font-weight:800;color:#2b6cb0;margin:6px 0}

/* xong chặng */
.done{text-align:center;position:relative}
.done h2{font-size:30px;margin:6px 0}
.gotstar{font-size:34px;font-weight:900;margin:4px 0}
.gotstar img.em{width:44px;height:44px}
.foundrow{display:flex;justify-content:center;gap:6px;flex-wrap:wrap;margin:6px 0 14px}
.badgebox{background:#fff;border-radius:var(--r);box-shadow:var(--shadow);padding:12px;margin:0 auto 14px;max-width:320px;font-weight:900;font-size:19px}
.badgeimg,.badgebox .emo img.em,.badge .emo img.em{width:84px;height:84px;object-fit:contain}
.burst{position:absolute;left:0;right:0;top:0;height:0;pointer-events:none}
.burst span{position:absolute;left:calc(10% + var(--i)*20%);top:0;animation:fly 1.4s ease-out forwards;opacity:0}
.burst img.em{width:34px;height:34px}
@keyframes fly{0%{opacity:1;transform:translateY(60px) scale(.5)}100%{opacity:0;transform:translateY(-30px) scale(1.2) rotate(30deg)}}

/* sao & huy hiệu */
.stars{text-align:center}
.bigstar{font-size:64px;font-weight:900;display:flex;justify-content:center;align-items:center;gap:10px}
.bigstar img.em{width:90px;height:90px}
.badges{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;max-width:420px;margin:0 auto}
.badge{background:#fff;border-radius:18px;padding:8px 4px;box-shadow:var(--shadow);font-weight:800;font-size:14px;display:flex;flex-direction:column;align-items:center}
.badge.off{filter:grayscale(1);opacity:.4}
.small{font-size:14px;color:var(--ink2)}

/* khung bật lên */
.scrim{position:fixed;inset:0;background:rgba(30,40,50,.45);display:none;align-items:flex-end;justify-content:center;z-index:50}
.scrim.show{display:flex}
.sheet{background:#fffdf8;width:100%;max-width:520px;max-height:92vh;overflow:auto;border-radius:26px 26px 0 0;padding:18px 16px 22px;animation:up .25s ease-out}
.sheet.wide{max-width:600px}
@media (min-width:700px){.scrim{align-items:center}.sheet{border-radius:26px}}
@keyframes up{from{transform:translateY(40px);opacity:.4}}
.set{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}
.seg{display:inline-flex;background:#efe6d9;border-radius:12px;padding:3px}
.seg button{border:0;background:transparent;border-radius:10px;padding:7px 12px;font-weight:800;font-size:15px}
.seg button.on{background:#fff;box-shadow:var(--shadow)}

/* ủng hộ & góp ý (mẫu chung) */
.sup-box{background:linear-gradient(135deg,#ffe8ef,#fff4c7);border-radius:18px;padding:14px;margin:12px 0}
.sup-box h3{margin:0 0 6px}
.qr{width:190px;max-width:70%;display:block;margin:8px auto;border-radius:12px;background:#fff;padding:6px}
.bank{font-size:15px;line-height:1.6}
.copy{background:var(--orange);color:#fff;border:0;border-radius:10px;padding:8px 12px;font-weight:800;margin-top:6px}
.credit{font-size:13px;color:var(--ink2);text-align:center}

#toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:#3a332c;color:#fff;padding:10px 16px;border-radius:14px;
  font-weight:700;z-index:90;opacity:0;pointer-events:none;transition:opacity .25s;max-width:90vw;text-align:center}
#toast.show{opacity:1}

@media (min-width:700px){
  .agrid,.pgrid{grid-template-columns:repeat(6,1fr)}
  .worlds{grid-template-columns:repeat(4,1fr)}
  .world{min-height:220px}
  .qtext{font-size:32px}
  .opts{max-width:820px}
  .opts.n4{grid-template-columns:repeat(4,1fr)}
  .badges{grid-template-columns:repeat(4,1fr);max-width:none}
}
@media (max-width:370px){
  body{font-size:16px}
  .qtext{font-size:23px}
  .logo{font-size:34px}
  .aname{font-size:15px}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
}
body.has-world .fb>div{background:rgba(255,255,255,.88);border-radius:18px;padding:6px 12px;box-shadow:var(--shadow)}

/* ===================== bản 0.3: 2 vòng + Look & Talk ===================== */
.rtabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;max-width:520px;margin:4px auto 6px}
.rtab{border:3px solid transparent;background:#fff;border-radius:16px;padding:8px 6px;box-shadow:var(--shadow);font-weight:900;font-size:17px;
  display:flex;align-items:center;justify-content:center;gap:6px;line-height:1.1}
.rtab.on{border-color:var(--green);background:#ecfaef}
.rtab.locked{opacity:.75;background:#f1eee8}
.rtab small{font-weight:800}
.agrid.n8,.agrid.n7{grid-template-columns:repeat(4,1fr)}
.agrid.n8 .aname,.agrid.n7 .aname{font-size:15px}
.rsub{font-weight:800;color:var(--ink2);margin:10px 0 6px;font-size:15px}
.lockinfo{text-align:center}
.lockinfo h2{margin:6px 0}
.need{background:#f6f3ee;border-radius:14px;padding:10px;margin:8px 0;font-weight:800;text-align:left;display:flex;gap:8px;align-items:center}
.need.ok{background:#e9f9ee;color:#1f7a42}
.openbox{background:#e9f9ee;border-radius:var(--r);padding:12px;margin:0 auto 14px;max-width:360px;font-weight:900;font-size:19px;color:#1f7a42;display:flex;flex-direction:column;gap:10px}
.bimg{position:relative;display:inline-block}
.bimg .gstar{position:absolute;right:-6px;top:-6px}
.bimg .gstar img.em{width:34px;height:34px;filter:drop-shadow(0 2px 2px rgba(0,0,0,.3))}
.badge small{font-weight:800;margin-top:2px}
.open2{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 10px}
.c{text-align:center}

/* danh sách tranh */
.sgrid{display:grid;grid-template-columns:1fr 1fr;gap:12px;max-width:820px;margin:0 auto}
.scard{position:relative;border:0;background:#fff;border-radius:18px;padding:6px 6px 10px;box-shadow:var(--shadow);text-align:center}
.sthumb{position:relative;display:block;aspect-ratio:4/3;border-radius:13px;overflow:hidden;background:#eef5f9}
.sthumb img{width:100%;height:100%;object-fit:cover;display:block}
.sthumb .emo img.em{width:60px;height:60px;margin-top:30%}
.scard.locked .sthumb img:not(.em){filter:grayscale(1) blur(2px);opacity:.55}
.slock{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}
.slock img.em{width:48px;height:48px}
.sname{display:block;font-weight:900;font-size:16px;margin-top:6px;line-height:1.15}

/* màn chơi Look & Talk */
.scene{position:relative;width:min(100%,calc(56vh * 4 / 3));aspect-ratio:4/3;margin:0 auto;border-radius:18px;overflow:hidden;box-shadow:var(--shadow);background:#eef5f9;user-select:none;-webkit-user-select:none}
.scene .simg{width:100%;height:100%;object-fit:cover;display:block}
.scene>.emo{display:flex;align-items:center;justify-content:center;height:100%}
.scene.tapmode{cursor:pointer;outline:4px dashed rgba(255,138,61,.55);outline-offset:-4px}
.scene.small{width:min(100%,calc(34vh * 4 / 3));margin-bottom:10px}
.ring{position:absolute;border-radius:16px;pointer-events:none}
.ring.subj{border:4px solid #ffb703;box-shadow:0 0 0 3px rgba(255,255,255,.7);animation:pulse 1.2s infinite}
.ring.hint{border:4px dashed #ffb703;animation:pulse 1s infinite}
.ring.good{border:5px solid var(--green);box-shadow:0 0 0 4px rgba(255,255,255,.8);animation:yay .5s}
.marks{position:absolute;inset:0;pointer-events:none}
.tapmark{position:absolute;width:44px;height:44px;margin:-22px 0 0 -22px;border-radius:50%;border:4px solid var(--red);animation:tapx .7s ease-out forwards}
@keyframes tapx{from{transform:scale(.4);opacity:1}to{transform:scale(1.2);opacity:0}}
.taphint{text-align:center;font-weight:800;color:var(--ink2);margin:8px 0 0}
.ans{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin:12px auto 0;max-width:640px}
.abtn{border:4px solid #fff;background:#fff;border-radius:20px;padding:10px 12px;box-shadow:var(--shadow);font-weight:900;font-size:18px;
  display:flex;flex-direction:column;align-items:center;gap:4px;min-width:96px;flex:1 1 0;line-height:1.1}
.abtn:active{transform:scale(.96)}
.abtn.good{border-color:var(--green);background:#e9f9ee;animation:yay .5s}
.abtn.bad{opacity:.4;animation:shake .4s;cursor:default}
.abtn.num b{font-size:40px;line-height:1}
.abtn.num .dots{color:var(--orange);letter-spacing:2px;font-size:16px}
.abtn.yes,.abtn.no{flex-direction:row;justify-content:center;font-size:24px;padding:14px}
.abtn.yes img.em,.abtn.no img.em{width:38px;height:38px}
.sw{width:54px;height:54px;border-radius:50%;border:3px solid #d8d2c6;display:block}
.dpic{width:58px;height:58px;display:flex;align-items:center;justify-content:center}
.dpic img{width:100%;height:100%;object-fit:contain}
.dpic img.em{width:46px;height:46px}
.dpic .emo img.em{width:46px;height:46px}

/* Talk Time */
.talk{text-align:center}
.talkhead{display:flex;align-items:center;justify-content:center;gap:8px;font-weight:900;font-size:20px;margin-bottom:10px;background:rgba(255,255,255,.85);border-radius:16px;padding:6px 10px}
.tlines{display:flex;flex-direction:column;gap:8px;max-width:560px;margin:0 auto 10px}
.tline{display:flex;align-items:center;gap:10px;background:#fff;border-radius:16px;padding:10px 12px;box-shadow:var(--shadow);text-align:left;font-weight:900;font-size:21px;border:3px solid transparent}
.tline.now{border-color:var(--orange);background:#fff3e6}

@media (min-width:700px){
  .agrid.n8,.agrid.n7{grid-template-columns:repeat(4,1fr)}
  .agrid.n9{grid-template-columns:repeat(5,1fr)}
  .agrid.n8 .acard,.agrid.n7 .acard,.agrid.n9 .acard{max-width:none}
  .sgrid{grid-template-columns:repeat(4,1fr)}
}
@media (max-width:370px){
  .abtn{min-width:80px;font-size:16px}
  .tline{font-size:18px}
}
