:root {
  --ink: #2b2250; --ink2: #6a6390; --bg: #fff8ec; --card: #ffffff; --line: #efe6d6;
  --pri: #6c4cf1; --pri2: #8c72ff; --yel: #ffc93c; --grn: #22b86a; --red: #ff5c66; --blu: #2fa8f0; --org: #ff9a3c;
  --r: 22px; --sh: 0 6px 0 rgba(43,34,80,.08), 0 10px 24px rgba(43,34,80,.08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Baloo Da 2', system-ui, sans-serif; color: var(--ink); background: #2b2250;
  background-image: radial-gradient(circle at 15% 20%, #4b3a8f 0, transparent 40%), radial-gradient(circle at 85% 80%, #3a7bd5 0, transparent 40%);
  display: flex; align-items: center; justify-content: center; gap: 48px;
}
.side { color: #fff; max-width: 300px; }
.side h1 { font-size: 40px; line-height: 1; margin: 0 0 8px; }
.side p { color: #cfc8f5; font-size: 16px; line-height: 1.45; margin: 0 0 14px; }
.side a { color: #ffd76a; font-weight: 700; text-decoration: none; display: block; margin: 6px 0; }
.side .tip { background: rgba(255,255,255,.08); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: #e4defc; }
#app {
  width: 400px; height: min(840px, 96vh); background: var(--bg); border-radius: 40px; overflow: hidden; position: relative;
  box-shadow: 0 0 0 10px #15102e, 0 30px 80px rgba(0,0,0,.5); display: flex; flex-direction: column;
}
@media (max-width: 760px) {
  body { display: block; background: var(--bg); }
  .side { display: none; }
  #app { width: 100%; height: 100dvh; border-radius: 0; box-shadow: none; }
}
.scr { flex: 1; overflow-y: auto; padding: 18px 16px 96px; scrollbar-width: none; }
.scr::-webkit-scrollbar { display: none; }
.scr.full { padding-bottom: 24px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h2 { font-size: 24px; margin: 4px 0 12px; line-height: 1.1; }
h3 { font-size: 18px; margin: 18px 0 8px; }
.muted { color: var(--ink2); }
.bn { font-family: 'Baloo Da 2', 'Hind Siliguri', sans-serif; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--pri); color: #fff; font-weight: 800; font-size: 18px;
  padding: 12px 20px; border-radius: 18px; box-shadow: 0 5px 0 #4a30c4; transition: transform .08s; width: 100%; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #4a30c4; }
.btn.grn { background: var(--grn); box-shadow: 0 5px 0 #168a4e; }
.btn.yel { background: var(--yel); color: var(--ink); box-shadow: 0 5px 0 #d9a316; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line); border: 2px solid var(--line); }
.btn.sm { font-size: 15px; padding: 8px 14px; width: auto; border-radius: 14px; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* Top bar */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ava { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; background: #fff; position: relative; flex: none; }
.ava.ring { padding: 4px; }
.ava .in { width: 100%; height: 100%; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.ava .pet { position: absolute; right: -6px; bottom: -4px; font-size: 20px; }
.who { flex: 1; min-width: 0; }
.who b { font-size: 19px; display: block; line-height: 1.1; }
.lvl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink2); font-weight: 700; }
.bar { height: 10px; background: #eee3cf; border-radius: 99px; overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--yel), var(--org)); border-radius: 99px; transition: width .5s; }
.chips { display: flex; gap: 6px; }
.chip { background: #fff; border-radius: 99px; padding: 4px 10px; font-weight: 800; font-size: 15px; box-shadow: var(--sh); white-space: nowrap; }

/* Cards */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--sh); margin-bottom: 14px; }
.hero { color: #fff; position: relative; overflow: hidden; }
.hero .big { position: absolute; right: -6px; bottom: -14px; font-size: 96px; opacity: .9; }
.hero small { font-weight: 700; opacity: .9; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.hero h2 { margin: 2px 0 4px; max-width: 70%; }
.hero p { margin: 0 0 12px; max-width: 64%; opacity: .95; line-height: 1.3; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.tile { background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--sh); text-align: left; }
.tile .ic { font-size: 30px; }
.tile b { display: block; font-size: 16px; line-height: 1.15; margin-top: 4px; }
.tile span { font-size: 13px; color: var(--ink2); }
.badges { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.bdg { flex: none; width: 64px; text-align: center; font-size: 11px; font-weight: 700; line-height: 1.1; }
.bdg i { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 18px; background: #fff3c9; font-style: normal; font-size: 28px; box-shadow: var(--sh); }
.bdg.off { opacity: .35; filter: grayscale(1); }

/* Bottom nav */
nav.tabs { position: absolute; left: 10px; right: 10px; bottom: 10px; background: #fff; border-radius: 26px; display: flex; padding: 6px; box-shadow: 0 8px 30px rgba(43,34,80,.18); z-index: 5; }
nav.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 800; color: var(--ink2); padding: 6px 0; border-radius: 20px; }
nav.tabs button i { font-style: normal; font-size: 22px; line-height: 1.1; }
nav.tabs button.on { background: #efeaff; color: var(--pri); }

/* Map */
.map { position: relative; padding: 4px 0 20px; }
.world { border-radius: 28px; padding: 16px; margin-bottom: 16px; position: relative; overflow: hidden; box-shadow: var(--sh); }
.world .wh { display: flex; align-items: center; gap: 10px; }
.world .wh .wi { font-size: 40px; }
.world .wh b { font-size: 20px; display: block; line-height: 1; }
.world .wh small { color: rgba(43,34,80,.7); font-weight: 700; }
.nodes { display: flex; gap: 10px; margin-top: 12px; }
.node { flex: 1; background: rgba(255,255,255,.85); border-radius: 18px; padding: 10px; text-align: center; font-weight: 800; font-size: 14px; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.node i { display: block; font-style: normal; font-size: 26px; }
.node.lock { opacity: .55; }
.node.done { background: #fff; outline: 3px solid var(--grn); }
.stars { color: #f5b301; letter-spacing: 2px; font-size: 14px; }
.lockveil { position: absolute; inset: 0; background: rgba(255,255,255,.35); backdrop-filter: grayscale(1); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; }

/* Lesson / game */
.ghead { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.ghead .x { width: 36px; height: 36px; border-radius: 12px; background: #fff; box-shadow: var(--sh); font-size: 18px; font-weight: 800; }
.ghead .bar { height: 14px; }
.ghead .bar i { background: linear-gradient(90deg, var(--grn), #5fe39b); }
.timer { font-weight: 800; background: #fff; border-radius: 12px; padding: 4px 10px; box-shadow: var(--sh); min-width: 54px; text-align: center; }
.timer.low { color: var(--red); }
.gbody { flex: 1; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; }
.gtype { font-size: 13px; font-weight: 800; color: var(--pri); text-transform: uppercase; letter-spacing: .08em; }
.prompt { font-size: 24px; font-weight: 800; margin: 4px 0 12px; line-height: 1.15; }
.pic { font-size: 96px; text-align: center; line-height: 1.1; margin: 6px 0; }
.speak { display: inline-flex; align-items: center; gap: 8px; background: var(--blu); color: #fff; border-radius: 20px; padding: 12px 18px; font-size: 18px; font-weight: 800; box-shadow: 0 5px 0 #1d7fbb; }
.speak.slow { background: #fff; color: var(--blu); box-shadow: 0 5px 0 #cfe9fa; border: 2px solid #cfe9fa; }
.speak-row { display: flex; gap: 10px; justify-content: center; margin: 8px 0 18px; }
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 14px; font-size: 20px; font-weight: 800; box-shadow: 0 4px 0 var(--line); text-align: center; }
.opt.small { font-size: 16px; text-align: left; line-height: 1.25; }
.opt.sel { border-color: var(--pri); background: #f3efff; }
.opt.ok { border-color: var(--grn); background: #e3f9ec; }
.opt.bad { border-color: var(--red); background: #ffe8ea; }
.masked { font-size: 44px; font-weight: 800; letter-spacing: 6px; text-align: center; margin: 10px 0 18px; }
.masked u { text-decoration: none; color: var(--pri); border-bottom: 4px solid var(--pri); padding: 0 4px; }
.slots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 58px; margin: 6px 0 14px; }
.slot, .tileL { width: 44px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.slot { background: #f1eadc; border: 2px dashed #d9ccb4; }
.slot.f { background: #fff; border: 2px solid var(--pri); color: var(--pri); }
.tiles { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tileL { background: #fff; box-shadow: 0 5px 0 var(--line); border: 2px solid var(--line); }
.tileL.used { visibility: hidden; }
.spellin { width: 100%; font: inherit; font-size: 30px; font-weight: 800; text-align: center; letter-spacing: 4px; padding: 12px; border-radius: 18px; border: 3px solid var(--line); background: #fff; color: var(--ink); outline: none; }
.spellin:focus { border-color: var(--pri); }
.hint { background: #fff7d9; border-radius: 16px; padding: 10px 14px; font-size: 15px; margin-bottom: 12px; }
.mic { width: 110px; height: 110px; border-radius: 50%; background: var(--red); color: #fff; font-size: 48px; box-shadow: 0 6px 0 #c9343d; margin: 10px auto; display: grid; place-items: center; }
.mic.rec { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,92,102,.6), 0 6px 0 #c9343d; } 50% { box-shadow: 0 0 0 18px rgba(255,92,102,0), 0 6px 0 #c9343d; } }
.score-ring { width: 120px; height: 120px; border-radius: 50%; margin: 6px auto; display: grid; place-items: center; font-size: 34px; font-weight: 800; }
.gfoot { padding: 12px 16px 18px; }
.fb { padding: 14px 16px 18px; border-radius: 26px 26px 0 0; animation: up .2s ease-out; }
.fb.ok { background: #d8f6e5; color: #11713f; }
.fb.bad { background: #ffe1e4; color: #b3222c; }
.fb > b { font-size: 22px; display: block; }
.fb p { margin: 2px 0 10px; font-size: 16px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* Learn card */
.learn { text-align: center; background: #fff; border-radius: 28px; padding: 20px 18px; box-shadow: var(--sh); }
.learn .word { font-size: 46px; font-weight: 800; line-height: 1; margin: 6px 0; letter-spacing: 1px; }
.learn .letters { display: flex; gap: 4px; justify-content: center; margin: 6px 0 10px; flex-wrap: wrap; }
.learn .letters span { background: #f3efff; color: var(--pri); border-radius: 8px; padding: 0 8px; font-weight: 800; font-size: 18px; }
.learn .mean { font-size: 17px; margin: 10px 0 4px; }
.learn .bnm { font-size: 22px; color: var(--org); font-weight: 700; }
.learn .ex { background: #f6f2ea; border-radius: 16px; padding: 10px; margin-top: 12px; font-size: 16px; font-style: italic; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 14px 0; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #e2d8c4; }
.dots i.on { background: var(--pri); width: 24px; border-radius: 99px; }

/* Results */
.result { text-align: center; padding-top: 10px; }
.result .trophy { font-size: 90px; animation: pop .5s; }
@keyframes pop { 0% { transform: scale(.2); } 70% { transform: scale(1.15); } }
.result .bigstars { font-size: 44px; color: #f5b301; letter-spacing: 6px; }
.rgrid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 16px 0; }
.rgrid div { background: #fff; border-radius: 18px; padding: 10px 4px; box-shadow: var(--sh); font-size: 13px; color: var(--ink2); font-weight: 700; }
.rgrid b { display: block; font-size: 24px; color: var(--ink); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(900px) rotate(720deg); } }

/* Lists */
.wlist .wi { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 18px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--sh); }
.wlist .wi .e { font-size: 28px; width: 36px; text-align: center; }
.wlist .wi .t { flex: 1; min-width: 0; }
.wlist .wi .t b { font-size: 17px; display: block; line-height: 1.1; }
.wlist .wi .bar { height: 8px; margin-top: 4px; }
.tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.tag.mastered { background: #d8f6e5; color: #11713f; }
.tag.practice { background: #fff1c9; color: #8a6200; }
.tag.weak { background: #ffe1e4; color: #b3222c; }
.tag.new { background: #ece8f7; color: var(--ink2); }
.seg { display: flex; background: #efe6d6; border-radius: 16px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 12px; font-weight: 800; font-size: 14px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.shop { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.item { background: #fff; border-radius: 20px; padding: 14px 10px; text-align: center; box-shadow: var(--sh); }
.item .ic { font-size: 44px; line-height: 1.1; height: 52px; display: grid; place-items: center; }
.item b { display: block; font-size: 15px; line-height: 1.15; margin: 4px 0 8px; min-height: 34px; }
.item .sw { width: 44px; height: 44px; border-radius: 50%; margin: 4px auto; border: 3px solid #eee; }
.lb .r { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 8px 12px; margin-bottom: 6px; box-shadow: var(--sh); font-weight: 700; }
.lb .r.me { outline: 3px solid var(--pri); }
.lb .r .n { width: 26px; text-align: center; font-weight: 800; color: var(--ink2); }
.lb .r .a { font-size: 24px; }
.lb .r .nm { flex: 1; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; font-size: 16px; line-height: 1.35; }
.msg.me { align-self: flex-end; background: var(--pri); color: #fff; border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: #fff; box-shadow: var(--sh); border-bottom-left-radius: 6px; }
.chatin { display: flex; gap: 8px; position: absolute; left: 12px; right: 12px; bottom: 90px; }
.chatin input { flex: 1; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); outline: none; }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.sugg button { background: #efeaff; color: var(--pri); font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 99px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 800; margin-bottom: 6px; }
.field input { width: 100%; font: inherit; font-size: 20px; padding: 12px 14px; border-radius: 16px; border: 3px solid var(--line); outline: none; }
.field input:focus { border-color: var(--pri); }
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pick button { background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 8px 14px; font-weight: 800; font-size: 18px; }
.pick button.on { border-color: var(--pri); background: #f3efff; color: var(--pri); }
.toast { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 16px; font-weight: 700; z-index: 30; font-size: 15px; animation: up .2s; max-width: 90%; text-align: center; }
.back { width: 38px; height: 38px; border-radius: 12px; background: #fff; box-shadow: var(--sh); font-size: 20px; font-weight: 800; flex: none; }
