:root {
  --bg: #fff8ec;
  --ink: #33302e;
  --soft: #7a716a;
  --card: #ffffff;
  --line: #f0e2cc;
  --orange: #ff8a3d;
  --orange-d: #e46a1c;
  --green: #2fae6a;
  --blue: #3a86ff;
  --pink: #ff5d8f;
  --yellow: #ffd23f;
  --purple: #8e6cf1;
  --hi: #e5383b;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(0, 0, 0, .08), 0 10px 24px rgba(120, 80, 20, .10);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg) radial-gradient(circle at 10% 0%, #ffe9c7 0, transparent 40%) fixed;
  color: var(--ink);
  font-family: "Segoe UI", "Nunito", Arial, sans-serif;
  font-size: 20px;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, a.btn { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: rgba(255, 248, 236, .92);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--line);
}
.top h1 { flex: 1; margin: 0; font-size: 26px; font-weight: 800; color: var(--orange-d); }
.top .home { font-size: 30px; }
.ghost { background: none; border: 0; font-size: 26px; }
main { max-width: 1100px; margin: 0 auto; padding: 18px 18px 80px; }

/* generic buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 999px;
  background: var(--orange); color: #fff; font-weight: 800;
  box-shadow: 0 5px 0 var(--orange-d);
  transition: transform .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange-d); }
.btn.green { background: var(--green); box-shadow: 0 5px 0 #1f8650; }
.btn.blue { background: var(--blue); box-shadow: 0 5px 0 #2563c9; }
.btn.pink { background: var(--pink); box-shadow: 0 5px 0 #d13a6b; }
.btn.purple { background: var(--purple); box-shadow: 0 5px 0 #6a49c9; }
.btn.white { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line); }
.speak { border: 0; background: #fff3e2; border-radius: 50%; width: 46px; height: 46px; font-size: 22px; flex: none; }

/* ===== map ===== */
.intro { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.intro .owl { font-size: 64px; }
.intro p { margin: 0; color: var(--soft); }
.intro b { color: var(--ink); }
.bar { height: 14px; background: #fde8c8; border-radius: 99px; overflow: hidden; margin-top: 8px; max-width: 380px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); border-radius: 99px; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.group {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px 16px;
  box-shadow: var(--shadow); border: 2px solid var(--line);
}
.group h3 { margin: 0 0 10px; font-size: 16px; color: var(--soft); font-weight: 700; letter-spacing: .5px; }
.group .vans { display: flex; flex-wrap: wrap; gap: 10px; }
.vb {
  position: relative; min-width: 72px; height: 72px; padding: 0 12px; border-radius: 22px; border: 0;
  font-size: 30px; font-weight: 800; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .15);
}
.vb:active { transform: translateY(3px); }
.vb.locked { background: #e7ded2 !important; color: #b5aa9c; box-shadow: none; cursor: default; }
.vb.locked::after { content: "🔒"; position: absolute; right: -6px; top: -8px; font-size: 18px; }
.vb.done::after { content: "⭐"; position: absolute; right: -6px; top: -10px; font-size: 22px; }
.vb.next { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.c0 { background: var(--orange); } .c1 { background: var(--green); } .c2 { background: var(--blue); }
.c3 { background: var(--pink); } .c4 { background: var(--purple); }
.parent { margin-top: 26px; font-size: 15px; color: var(--soft); text-align: center; }
.parent label { cursor: pointer; }

/* ===== lesson ===== */
.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center;
  background: var(--card); border-radius: 28px; padding: 18px 22px; box-shadow: var(--shadow);
  border: 2px solid var(--line);
}
.vanbig {
  font-size: 110px; font-weight: 900; line-height: 1; color: var(--hi);
  background: #fff1f1; border-radius: 26px; padding: 14px 28px; border: 0; min-width: 190px;
}
.vanbig small { display: block; font-size: 18px; color: var(--soft); font-weight: 600; margin-top: 6px; }
.hero h2 { margin: 0 0 6px; font-size: 22px; color: var(--soft); font-weight: 700; }
.acts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.sec { margin: 26px 0 12px; font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.sec::before { content: ""; width: 10px; height: 28px; border-radius: 6px; background: var(--yellow); }
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.wc {
  background: var(--card); border-radius: var(--radius); border: 2px solid var(--line);
  box-shadow: var(--shadow); padding: 10px; text-align: center; cursor: pointer;
  transition: transform .1s;
}
.wc:hover { transform: translateY(-3px); }
.wc.talk { outline: 4px solid var(--yellow); }
.pic {
  aspect-ratio: 4/3; border-radius: 16px; background: #fff; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.pic img { width: 100%; height: 100%; object-fit: contain; }
.pic .emo { font-size: 92px; line-height: 1; }
.pic.emoji { background: #fff7e8; }
.ww { font-size: 30px; font-weight: 800; margin-top: 6px; }
.hl { color: var(--hi); }
.sents { display: grid; gap: 10px; }
.sent {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px;
  padding: 10px 14px; border: 2px solid var(--line); font-size: 30px; font-weight: 700;
}
.src { font-size: 12px; color: var(--soft); margin-top: 18px; }

/* ===== games ===== */
.gamehead { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.gamehead h2 { margin: 0; flex: 1; font-size: 26px; }
.stars { font-size: 26px; letter-spacing: 2px; }
.stage {
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow); border: 2px solid var(--line);
  padding: 22px; text-align: center;
}
.q-pic { max-width: 440px; margin: 0 auto 10px; }
.q-pic .pic { border: 2px solid var(--line); }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.opt {
  font-size: 34px; font-weight: 800; padding: 16px; border-radius: 22px; border: 3px solid var(--line);
  background: #fff; box-shadow: 0 5px 0 var(--line); color: var(--ink);
}
.opt.ok { background: #dcf7e7; border-color: var(--green); color: #18794a; }
.opt.no { background: #ffe1e1; border-color: var(--hi); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.hint { color: var(--soft); font-size: 18px; margin: 4px 0 0; }

/* Hái quả */
.orchard { position: relative; height: 520px; max-width: 760px; margin: 0 auto; }
.tree { position: absolute; inset: 0; }
.fruit {
  position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, #ffb3a7, #ff5a4e 55%, #d8322a);
  color: #fff; font-size: 26px; font-weight: 800; text-shadow: 0 2px 2px rgba(0, 0, 0, .35);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .2);
  transition: top .7s cubic-bezier(.5, -0.3, .7, 1.2), left .7s, transform .2s, opacity .3s;
}
.fruit.o { background: radial-gradient(circle at 35% 30%, #ffe08a, #ffb020 55%, #e08a00); }
.fruit.g { background: radial-gradient(circle at 35% 30%, #c8f59a, #6cc24a 55%, #3f9a27); }
.fruit::before {
  content: ""; position: absolute; top: -10px; left: 50%; width: 18px; height: 12px; margin-left: -2px;
  background: #4caf50; border-radius: 0 12px 0 12px;
}
.fruit.no { animation: shake .4s; }
.fruit.in { transform: scale(.7); }
.basket {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 220px; height: 90px; border-radius: 10px 10px 80px 80px;
  background: repeating-linear-gradient(45deg, #c98a4b 0 12px, #b5763a 12px 24px);
  color: #fff; font-weight: 800; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px;
}

/* story */
.story { text-align: left; }
.story h2 { margin: 0 0 8px; font-size: 30px; color: var(--orange-d); }
.story .line { font-size: 30px; line-height: 1.6; cursor: pointer; border-radius: 8px; padding: 0 4px; }
.story .line:hover, .story .line.talk { background: #fff1c2; }
.qs { display: grid; gap: 16px; margin-top: 20px; }
.qbox { background: #f7f2ff; border-radius: 20px; padding: 14px 16px; }
.qbox p { margin: 0 0 10px; font-size: 26px; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.qbox .opts { margin-top: 0; grid-template-columns: 1fr 1fr; }
.qbox .opt { font-size: 26px; padding: 10px; }

/* pdf */
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.sheet {
  background: var(--card); border-radius: var(--radius); border: 2px solid var(--line); box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center;
}
.sheet .ico { font-size: 54px; }
.sheet b { font-size: 20px; }
.sheet .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.sheet .btn { font-size: 16px; padding: 8px 14px; }
.sheet { position: relative; padding-top: 40px; opacity: .6; transition: opacity .15s, border-color .15s; }
.sheet.on { opacity: 1; border-color: var(--purple); }
.sheet .pick, .pickall { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; cursor: pointer; user-select: none; }
.sheet .pick { position: absolute; top: 10px; left: 12px; font-size: 15px; color: var(--soft); }
.sheet input[type=checkbox], .pickall input { width: 22px; height: 22px; accent-color: var(--purple); cursor: pointer; }
.pickbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0 0 16px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
}
.pickbar .row { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.pickbar .btn { font-size: 17px; padding: 10px 16px; }
.pickbar .btn:disabled { opacity: .45; cursor: not-allowed; }
.pickall { font-size: 18px; }
.pickcount { color: var(--soft); }
.getapp { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.getapp .btn { font-size: 17px; padding: 10px 18px; }

/* finish + toast */
.win { padding: 30px 10px; }
.win .big { font-size: 90px; }
.win h2 { font-size: 36px; margin: 6px 0 16px; color: var(--green); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 99px; font-weight: 700;
  transition: transform .3s, visibility .3s; z-index: 50; max-width: 90vw; text-align: center; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall 1.8s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 640px) {
  body { font-size: 18px; }
  .hero { grid-template-columns: 1fr; text-align: center; }
  .acts { justify-content: center; }
  .vanbig { font-size: 80px; }
  .orchard { height: 460px; }
  .fruit { width: 78px; height: 78px; margin: -39px 0 0 -39px; font-size: 21px; }
}
