:root {
  --ink: #263238; --soft: #607d8b; --card: #ffffff; --line: #e3e8f4;
  --go: #6c5ce7; --go2: #a29bfe; --ok: #00b894; --bad: #ff7675; --warn: #fdcb6e;
  --r: 22px; --shadow: 0 6px 0 rgba(60, 64, 120, .12), 0 10px 24px rgba(60, 64, 120, .10);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(circle at 15% 10%, #fff6d8 0, transparent 30%), radial-gradient(circle at 85% 20%, #e3f2ff 0, transparent 35%),
    radial-gradient(circle at 50% 100%, #f3e5ff 0, transparent 45%), linear-gradient(180deg, #eef6ff, #fbf3ff);
  background-attachment: fixed; overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .7;
  background-image: radial-gradient(2px 2px at 10% 20%, #b39ddb 50%, transparent 51%), radial-gradient(2px 2px at 30% 70%, #90caf9 50%, transparent 51%),
    radial-gradient(3px 3px at 70% 30%, #ffcc80 50%, transparent 51%), radial-gradient(2px 2px at 85% 75%, #f48fb1 50%, transparent 51%),
    radial-gradient(2px 2px at 50% 45%, #80cbc4 50%, transparent 51%), radial-gradient(3px 3px at 20% 90%, #ce93d8 50%, transparent 51%);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35 } to { opacity: .9 } }
#app { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 0 14px 60px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
h1, h2, h3 { margin: .3em 0; }
h2 { font-size: 1.6rem; }
.thai { color: #6a1b9a; font-size: .92em; margin-top: 2px; font-family: "Sukhumvit Set", "Thonburi", "Noto Sans Thai", sans-serif; }
.small, .hint { color: var(--soft); font-size: .95rem; text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.row.c { justify-content: center; } .row.sp { justify-content: space-between; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 4px; flex-wrap: wrap;
  background: rgba(255, 255, 255, .78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 0 0 20px 20px; margin: 0 -6px 10px; padding-left: 10px; padding-right: 10px; box-shadow: 0 4px 14px rgba(60, 64, 120, .08); }
.home-btn { font-size: 1.6rem; background: #fff; border-radius: 14px; width: 48px; height: 48px; box-shadow: var(--shadow); }
.rank { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 140px; }
.rk-ic { font-size: 1.8rem; }
.bar { height: 10px; background: #e8eaf6; border-radius: 99px; overflow: hidden; width: 120px; margin-top: 3px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd54f, #ff7043); border-radius: 99px; transition: width .6s; }
.chip { background: #fff; border-radius: 99px; padding: 8px 12px; font-weight: 800; box-shadow: var(--shadow); white-space: nowrap; }
.chip.th.on { background: #6a1b9a; color: #fff; }
.count-chip { text-align: center; margin: 8px auto; background: linear-gradient(90deg, #ffecb3, #ffe0f0); border: 2px solid #ffd180;
  border-radius: 99px; padding: 10px 18px; font-weight: 800; width: fit-content; animation: glow 2s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: 0 0 0 rgba(255, 171, 64, 0) } to { box-shadow: 0 0 22px rgba(255, 171, 64, .55) } }

/* buttons */
.btn { border-radius: 18px; padding: 14px 22px; font-weight: 800; font-size: 1.1rem; background: #fff; box-shadow: var(--shadow); transition: transform .12s; }
.btn:active { transform: translateY(3px) scale(.98); }
.btn.go { background: linear-gradient(180deg, #7c6cf0, #5b4bd8); color: #fff; }
.btn.ok { background: linear-gradient(180deg, #2ed3a5, #00a884); color: #fff; }
.btn.warn { background: linear-gradient(180deg, #ff8a80, #f06060); color: #fff; }
.btn.big { font-size: 1.3rem; padding: 18px 30px; }
.btn.ghostbtn { background: #fff; color: var(--go); }
.btn:disabled { opacity: .45; }
.link { color: var(--soft); text-decoration: underline; font-weight: 700; padding: 8px; }
.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.06) } }
.spk { background: #ede7f6; border-radius: 14px; min-width: 46px; height: 46px; font-size: 1.3rem; box-shadow: 0 3px 0 rgba(0, 0, 0, .08); padding: 0 8px; }
.spk.sm { min-width: 34px; height: 34px; font-size: 1rem; border-radius: 10px; vertical-align: middle; }
.spk.th { background: #f3e5f5; color: #6a1b9a; font-weight: 800; font-size: .95rem; }
.spk.corner { position: absolute; top: 6px; right: 6px; }

/* splash */
.splash { text-align: center; padding: 8vh 10px; position: relative; }
.splash h1 { font-size: clamp(2rem, 6vw, 3.4rem); background: linear-gradient(90deg, #6c5ce7, #e84393, #fd9644); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash .sub { font-size: 1.2rem; color: var(--soft); }
.rocket { font-size: 6rem; display: inline-block; }
.launchy { animation: hover 2.4s ease-in-out infinite; }
@keyframes hover { 0%, 100% { transform: translateY(0) rotate(-8deg) } 50% { transform: translateY(-16px) rotate(4deg) } }
.rocket.launch { animation: launch 2.2s ease-in forwards; }
@keyframes launch { 0% { transform: translateY(0) } 30% { transform: translateY(6px) rotate(-3deg) } 100% { transform: translateY(-90vh) scale(.6) } }
.planets span { position: absolute; font-size: 3rem; animation: drift 7s ease-in-out infinite alternate; }
.planets .p1 { left: 6%; top: 8%; } .planets .p2 { right: 8%; top: 14%; animation-delay: 1s } .planets .p3 { left: 14%; bottom: 10%; animation-delay: 2s }
@keyframes drift { from { transform: translate(0, 0) rotate(0) } to { transform: translate(14px, 18px) rotate(14deg) } }
.float { animation: floaty 3s ease-in-out infinite; display: inline-block; }
@keyframes floaty { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }

/* mascot */
.mascot { display: flex; align-items: center; gap: 12px; margin: 10px 0 16px; }
.astro { font-size: 3.4rem; }
.bubble { background: #fff; border-radius: 20px; padding: 14px 18px; font-weight: 700; font-size: 1.1rem; box-shadow: var(--shadow); position: relative; }
.bubble::before { content: ""; position: absolute; left: -10px; top: 50%; border: 10px solid transparent; border-right-color: #fff; transform: translateY(-50%); border-left: 0; }

/* home map */
.map { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.station { position: relative; background: #fff; border-radius: var(--r); padding: 20px 14px 16px; box-shadow: var(--shadow); text-align: center;
  border-bottom: 6px solid var(--c); display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .15s; }
.station:hover { transform: translateY(-4px) rotate(-1deg); }
.st-ic { font-size: 3rem; width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--c) 30%, #fff)); }
.station b { font-size: 1.15rem; }
.st-badge { font-size: .85rem; color: var(--soft); font-weight: 700; min-height: 1em; }

/* grids */
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.tcard { background: #fff; border-radius: var(--r); padding: 18px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tc-ic { font-size: 2.8rem; }
.stars { color: #ffb300; font-size: 1.3rem; letter-spacing: 2px; }
.acc { color: var(--soft); font-weight: 700; } .acc.new { color: #e84393; }
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.wcard { background: #fff; border-radius: 18px; padding: 12px 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wcard b { font-size: 1.1rem; }
.boing { animation: boing .5s; }
@keyframes boing { 0% { transform: scale(1) } 30% { transform: scale(1.18) rotate(-3deg) } 60% { transform: scale(.95) } 100% { transform: scale(1) } }

/* visuals */
.emo { font-size: 3.6rem; line-height: 1.1; display: inline-block; }
.emo.xl { font-size: 4.6rem; }
.blob { width: 70px; height: 70px; border-radius: 50%; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15); }
.blob.white { border: 3px solid #cfd8dc; }
.num { font-size: 3rem; font-weight: 900; color: #3949ab; min-width: 80px; }
.combo { position: relative; display: flex; align-items: flex-end; justify-content: center; }
.combo .ca { font-size: 3.8rem; } .combo .cb { font-size: 2.6rem; margin-left: -10px; }
.count { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 220px; }
.count.cs span { font-size: 2.3rem; } .count.cm span { font-size: 1.7rem; } .count.cl span { font-size: 1.35rem; }
.txt { font-size: 1.2rem; font-weight: 700; padding: 6px 10px; }
.scene { position: relative; width: 100%; max-width: 230px; aspect-ratio: 4 / 3; container-type: inline-size; background: linear-gradient(180deg, #e3f2fd 0 70%, #c8e6c9 70%); border-radius: 14px; overflow: hidden; margin: 0 auto; }
.scene .obj { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }
.scene .obj.front { z-index: 3; }
.scene .animal, .scene .big-obj { position: absolute; transform: translate(-50%, -50%); line-height: 1; }
.yn { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 2.6rem; }
.yn b { font-size: 1.3rem; }

/* question card */
.qcard { background: #fff; border-radius: 26px; padding: 16px; box-shadow: var(--shadow); }
.ins { display: flex; align-items: center; gap: 10px; background: #f3f0ff; border-radius: 16px; padding: 10px; }
.ins-t { flex: 1; font-size: 1.08rem; }
.prompt { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 14px 0; }
.play { display: flex; align-items: center; gap: 12px; background: linear-gradient(180deg, #4fc3f7, #1e88e5); color: #fff; border-radius: 22px;
  padding: 14px 26px; box-shadow: 0 6px 0 #1565c0; font-size: 1.3rem; }
.play small { display: block; font-size: .8rem; opacity: .9; margin-left: 4px; }
.play .wave { font-size: 2rem; }
.play.playing .wave { animation: wave .6s ease-in-out infinite alternate; }
@keyframes wave { from { transform: scale(1) } to { transform: scale(1.3) } }
.play:disabled { background: #b0bec5; box-shadow: 0 6px 0 #90a4ae; }
.qtext { font-weight: 800; font-size: 1.2rem; background: #fff8e1; border-radius: 14px; padding: 8px 14px; }
.rtext { font-size: 1.45rem; font-weight: 700; text-align: center; line-height: 1.5; padding: 4px 8px; }
.gap { display: inline-block; min-width: 70px; border-bottom: 4px dashed #7c6cf0; color: #7c6cf0; margin: 0 6px; }
.qpic .emo { font-size: 5.5rem; }
.opts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opts.n4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .opts.n4 { grid-template-columns: repeat(4, 1fr); } }
.opts.txtopts { grid-template-columns: 1fr; }
.opts.ynopts { grid-template-columns: 1fr 1fr; max-width: 420px; margin: 0 auto; }
.opt { position: relative; background: #fafbff; border: 4px solid var(--line); border-radius: 22px; min-height: 120px; padding: 10px;
  display: flex; align-items: center; justify-content: center; transition: transform .12s, border-color .2s; }
.txtopts .opt { min-height: 70px; }
.opt:hover:not(:disabled) { border-color: #b39ddb; transform: translateY(-3px); }
.opt.chosen { border-color: #7c6cf0; background: #f3f0ff; }
.opt.right { border-color: var(--ok) !important; background: #e8fff7 !important; animation: glowok 1s ease-in-out 2; }
.opt.right::after { content: "✅"; position: absolute; top: -12px; right: -10px; font-size: 1.8rem; }
.opt.wrong { border-color: var(--bad) !important; background: #fff0f0 !important; opacity: .8; }
.opt.wrong::after { content: "❌"; position: absolute; top: -12px; right: -10px; font-size: 1.6rem; }
@keyframes glowok { 50% { box-shadow: 0 0 0 8px rgba(0, 184, 148, .25) } }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px) } 40%, 80% { transform: translateX(8px) } }

/* colouring */
.palette { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 8px 0 14px; }
.pal { width: 56px; height: 56px; border-radius: 50%; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), 0 3px 8px rgba(0, 0, 0, .15); transition: transform .15s; }
.pal.on { transform: scale(1.2); outline: 5px solid #263238; outline-offset: 3px; }
.palette.nudge { animation: shake .45s; }
.paintscene { display: flex; justify-content: center; align-items: flex-end; gap: 16px; flex-wrap: wrap; background: #f1f8e9; border-radius: 18px; padding: 16px; }
.pobj { background: #fff; border-radius: 18px; padding: 8px; border: 4px solid transparent; }
.pobj.size-mid .paintobj { width: 110px; } .pobj.size-big .paintobj { width: 150px; } .pobj.size-small .paintobj { width: 70px; }
.pobj.splat { animation: boing .45s; }
.pobj.right { border-color: var(--ok); } .pobj.wrong { border-color: var(--bad); }
.paintobj svg { width: 100%; display: block; }

/* tiles */
.tilepic { text-align: center; } .tilepic .emo { font-size: 5rem; }
.slots { display: flex; gap: 8px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.slot { width: 56px; height: 64px; border-radius: 14px; border: 3px dashed #b39ddb; font-size: 2rem; font-weight: 900; text-transform: lowercase; background: #faf8ff; }
.slot.full { border-style: solid; background: #fff; }
.slot.right { border-color: var(--ok); background: #e8fff7; } .slot.wrong { border-color: var(--bad); background: #fff0f0; }
.line { min-height: 74px; border: 3px dashed #b39ddb; border-radius: 18px; padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 12px 0; background: #faf8ff; }
.ghost { color: #b0bec5; font-weight: 700; }
.tray { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tile { background: linear-gradient(180deg, #fff59d, #ffd54f); border-radius: 14px; padding: 12px 16px; font-size: 1.6rem; font-weight: 900; box-shadow: 0 5px 0 #f9a825; min-width: 56px; }
.tile.inline { font-size: 1.3rem; padding: 10px 14px; background: linear-gradient(180deg, #e1f5fe, #b3e5fc); box-shadow: 0 4px 0 #4fc3f7; }
.tile.used { visibility: hidden; }
.answer-line { text-align: center; font-size: 1.4rem; font-weight: 800; color: #00897b; margin-top: 10px; }

/* story */
.story { background: #fffdf3; border: 3px solid #ffe082; border-radius: 18px; padding: 12px 16px; margin: 12px 0; }
.story-h { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; }
.story-pic { font-size: 2.4rem; }
.story p { font-size: 1.2rem; margin: 8px 0; line-height: 1.5; }

/* feedback */
.feedback { margin-top: 14px; }
.fb { border-radius: 20px; padding: 14px 16px; font-size: 1.15rem; }
.fb.good { background: #e8fff7; border: 3px solid #55efc4; }
.fb.bad { background: #fff7e6; border: 3px solid #ffd180; }
.why { margin-top: 8px; font-weight: 700; color: #4e342e; }
.heard { margin-top: 6px; color: #455a64; font-size: 1rem; }
.progress { position: relative; height: 22px; background: #fff; border-radius: 99px; overflow: hidden; margin: 8px 0 12px; box-shadow: var(--shadow); }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #a29bfe, #6c5ce7); transition: width .4s; }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.rtitle { font-size: 1.15rem; }

/* teach */
.learn-tag, .demo-tag { display: inline-block; background: #e1f5fe; color: #01579b; border-radius: 99px; padding: 6px 14px; font-weight: 800; margin: 6px 0; }
.demo-tag { background: #fff3e0; color: #e65100; }
.teach { display: grid; gap: 10px; }
.tline { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 1.2rem; font-weight: 700; }
.tline > span:nth-child(2) { flex: 1; }
.tl-ic { font-size: 2rem; }
.demo { margin-top: 12px; }

/* sections, results */
.section-card, .result { background: #fff; border-radius: 28px; padding: 24px; box-shadow: var(--shadow); text-align: center; margin-top: 10px; }
.brief-ic { font-size: 4.5rem; }
.tlist { text-align: left; max-width: 520px; margin: 10px auto; font-size: 1.15rem; line-height: 1.9; list-style: none; padding: 0; }
.bigstars { font-size: 4rem; letter-spacing: 8px; }
.bigstars .on { color: #ffc107; display: inline-block; } .bigstars .off { color: #e0e0e0; }
.score { font-size: 2rem; font-weight: 900; color: #5b4bd8; margin: 6px 0; }
.split { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.split > div { background: #f3f0ff; border-radius: 16px; padding: 10px 18px; font-weight: 700; }
.split b { display: block; font-size: 1.6rem; }
.band { margin: 14px auto 4px; font-size: 1.3rem; background: linear-gradient(90deg, #e3f2fd, #fce4ec); border-radius: 99px; padding: 10px 18px; width: fit-content; }
.review { text-align: left; margin: 12px 0; }
.rv { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #ddd; padding: 6px 0; }
.rv .ok { color: #00897b; font-weight: 800; }
.review.big { display: grid; gap: 16px; }
.rvcard { background: #fafbff; border-radius: 20px; padding: 10px; border: 2px solid var(--line); }
.rv-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* briefing / headset */
.dots { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #d1c4e9; } .dots i.on { background: #6c5ce7; }
.brief-card { background: #fff; border-radius: 28px; padding: 28px 20px; text-align: center; box-shadow: var(--shadow); }
.brief-t { font-size: 1.5rem; font-weight: 800; line-height: 1.45; }
.hs { text-align: center; background: #fff; border-radius: 28px; padding: 24px; box-shadow: var(--shadow); }
.hs-ic { font-size: 5rem; } .hs p { font-size: 1.2rem; font-weight: 700; } .hs-status { min-height: 1.5em; font-weight: 800; color: #1e88e5; }
.tips { display: none; text-align: left; background: #fff8e1; border-radius: 16px; padding: 12px 18px; margin-top: 10px; }
.tips.show { display: block; }

/* stickers */
.sticker { background: #fff; border-radius: 20px; padding: 16px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.sk-e { font-size: 3rem; } .sticker.locked { opacity: .5; filter: grayscale(1); }
.sticker.got { animation: none; background: radial-gradient(circle at 50% 30%, #fffde7, #fff); }

/* parents */
.gate-in { font-size: 1.6rem; padding: 10px; border-radius: 14px; border: 3px solid #d1c4e9; width: 140px; display: block; margin: 10px auto; text-align: center; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pcard { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); line-height: 1.6; }
.ptable { width: 100%; border-collapse: collapse; background: #fff; border-radius: 16px; overflow: hidden; margin-top: 12px; box-shadow: var(--shadow); }
.ptable td, .ptable th { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; }
.pill { border-radius: 99px; padding: 2px 10px; font-weight: 800; } .pill.g { background: #c8f7e4; } .pill.y { background: #fff3c4; } .pill.r { background: #ffd6d6; }
.wlog { display: grid; gap: 6px; } .wl { background: #fff; border-radius: 12px; padding: 8px 12px; }
.wl small { color: #7e57c2; font-weight: 800; }
.rtxt { white-space: pre-wrap; background: #fff; border-radius: 14px; padding: 12px; font-size: .8rem; color: #455a64; }

/* effects */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.xpfloat { position: fixed; z-index: 60; font-weight: 900; font-size: 1.5rem; color: #ff9100; transform: translate(-50%, 0); pointer-events: none;
  text-shadow: 0 2px 0 #fff; animation: rise 1.3s ease-out forwards; }
@keyframes rise { to { transform: translate(-50%, -90px); opacity: 0 } }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #263238; color: #fff; padding: 14px 22px; border-radius: 99px;
  font-weight: 800; z-index: 70; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: tin .3s; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes tin { from { transform: translate(-50%, 30px); opacity: 0 } }
.pop { animation: pop .38s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(.7); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.fadein { animation: fade .25s; }
@keyframes fade { from { opacity: 0; transform: translateY(8px) } }
@media (max-width: 520px) {
  .rank .bar { width: 80px; } .chip { padding: 6px 9px; font-size: .9rem; } .opt { min-height: 100px; }
  .emo { font-size: 3rem; } .rtext { font-size: 1.25rem; } .brief-t { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
