:root {
  --ink: #3d3553;
  --soft: #7a7194;
  --purple: #7b6cf6;
  --purple-d: #5a4bd1;
  --pink: #ff8fab;
  --mint: #8ee3c8;
  --yellow: #ffd166;
  --sky: #a0c4ff;
  --peach: #ffadad;
  --lilac: #cdb4db;
  --green: #3cc58f;
  --red: #ff6b8b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Andika', 'Comic Sans MS', sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #e7e1f6 0%, #f7ecef 45%, #fff6dc 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, .btn, .fredoka, .logo, .tag, .stars-pill { font-family: 'Fredoka', sans-serif; }

button { font: inherit; color: inherit; }

/* ---------- Background clouds ---------- */
.bg-clouds { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.bg-clouds .c {
  position: absolute; background: rgba(255,255,255,.65); border-radius: 999px;
  filter: blur(1px); animation: drift linear infinite;
}
.bg-clouds .c::before, .bg-clouds .c::after {
  content: ''; position: absolute; background: inherit; border-radius: 50%;
}
.bg-clouds .c::before { width: 55%; height: 160%; left: 15%; top: -70%; }
.bg-clouds .c::after { width: 40%; height: 130%; right: 12%; top: -45%; }
.c1 { width: 180px; height: 50px; top: 14%; animation-duration: 60s; }
.c2 { width: 240px; height: 64px; top: 46%; animation-duration: 85s; animation-delay: -30s; opacity: .7; }
.c3 { width: 140px; height: 40px; top: 72%; animation-duration: 70s; animation-delay: -50s; }
.c4 { width: 200px; height: 56px; top: 28%; animation-duration: 95s; animation-delay: -70s; opacity: .5; }
@keyframes drift { from { left: -300px; } to { left: 110%; } }

/* ---------- Teacher tag ---------- */
.tag {
  position: fixed; top: 14px; right: 16px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 18px 7px 8px; border-radius: 999px;
  background: linear-gradient(135deg, #ff8fab, #ffb86b);
  color: #fff; font-weight: 600; font-size: 1.05rem; letter-spacing: .3px;
  box-shadow: 0 4px 0 #e0607f, 0 10px 20px rgba(224,96,127,.25);
  transform: rotate(2deg);
  animation: wiggle 5s ease-in-out infinite;
}
.tag .av {
  width: 32px; height: 32px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: 1.1rem;
}
@keyframes wiggle { 0%, 90%, 100% { transform: rotate(2deg); } 93% { transform: rotate(-4deg); } 96% { transform: rotate(5deg); } }

/* ---------- Header ---------- */
header.top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 190px 8px 20px; max-width: 1180px; margin: 0 auto;
}
.logo {
  display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; text-align: left;
}
.logo-ico {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; font-size: 1.8rem;
  background: #fff; box-shadow: 0 4px 0 #d9d0f3;
}
.logo-txt b { display: block; font-size: 1.55rem; color: var(--purple); line-height: 1; }
.logo-txt small { color: var(--soft); font-size: .9rem; font-weight: 500; }
.stars-pill {
  margin-left: auto; background: #fff; padding: 8px 16px; border-radius: 999px;
  font-weight: 600; font-size: 1.2rem; box-shadow: 0 4px 0 #f1dca0;
}
.stars-pill .st { color: #ffb703; }
.stars-pill small { color: var(--soft); font-size: .85rem; }
.stars-pill.bump { animation: bump .5s; }
@keyframes bump { 50% { transform: scale(1.25); } }

main { max-width: 1180px; margin: 0 auto; padding: 8px 20px 70px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; cursor: pointer; font-size: 1.1rem; font-weight: 600;
  padding: 12px 22px; border-radius: 18px; background: var(--purple); color: #fff;
  box-shadow: 0 5px 0 var(--purple-d); transition: transform .08s, box-shadow .08s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--purple-d); }
.btn.ghost { background: #fff; color: var(--purple); box-shadow: 0 5px 0 #d9d0f3; }
.btn.pink { background: var(--pink); box-shadow: 0 5px 0 #e0607f; }
.btn.green { background: var(--green); box-shadow: 0 5px 0 #26a172; }
.btn.small { padding: 8px 14px; font-size: .95rem; border-radius: 14px; }
.say {
  border: none; background: #fff3c4; border-radius: 50%; width: 42px; height: 42px; font-size: 1.2rem;
  cursor: pointer; box-shadow: 0 3px 0 #f1d27a; flex-shrink: 0;
}
.say:active { transform: translateY(2px); box-shadow: none; }

.card {
  background: #fff; border-radius: 28px; padding: 22px;
  box-shadow: 0 8px 0 rgba(123,108,246,.12), 0 16px 34px rgba(61,53,83,.08);
}

/* ---------- Home ---------- */
.hero {
  display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f4f0ff 100%);
  border-radius: 34px; padding: 22px 28px; margin: 10px 0 22px;
  box-shadow: 0 8px 0 rgba(123,108,246,.14);
}
.hero h1 { margin: 0 0 6px; font-size: 2.3rem; color: var(--ink); }
.hero h1 span { color: var(--pink); }
.hero p { font-size: 1.25rem; margin: 6px 0 12px; line-height: 1.5; }
.bubble {
  position: relative; background: #fff8e1; border-radius: 22px; padding: 12px 18px; font-size: 1.2rem;
  display: inline-block; border: 3px dashed #ffd166;
}
.tips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tip {
  background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 1rem;
  box-shadow: 0 3px 0 #ece6fb;
}
.kabi { animation: float 3.5s ease-in-out infinite; transform-origin: center; }
@keyframes float { 50% { transform: translateY(-10px); } }

.section-title { font-size: 1.6rem; margin: 6px 4px 14px; }
.missions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.mission {
  position: relative; border: none; cursor: pointer; text-align: left;
  border-radius: 28px; padding: 20px; min-height: 170px; color: var(--ink);
  box-shadow: 0 7px 0 rgba(0,0,0,.09); transition: transform .15s;
  overflow: hidden;
}
.mission:hover { transform: translateY(-5px) rotate(-1deg); }
.mission .num {
  position: absolute; top: 14px; right: 16px; background: rgba(255,255,255,.7);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: 'Fredoka'; font-weight: 700;
}
.mission .ico { font-size: 3rem; display: block; margin-bottom: 6px; }
.mission h3 { margin: 0; font-size: 1.45rem; }
.mission p { margin: 4px 0 10px; font-size: 1.05rem; }
.mstars { font-size: 1.4rem; letter-spacing: 2px; color: rgba(0,0,0,.15); }
.mstars .on { color: #ff9f1c; text-shadow: 0 2px 0 #fff; }
.mission::after {
  content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.25); right: -30px; bottom: -40px;
}
.teacher-note {
  margin-top: 26px; font-size: .95rem; color: var(--soft); background: rgba(255,255,255,.6);
  border-radius: 18px; padding: 12px 16px; line-height: 1.5;
}
.teacher-note b { color: var(--ink); }

/* ---------- View head ---------- */
.view-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; flex-wrap: wrap; }
.view-head h2 { margin: 0; font-size: 1.9rem; }
.ls {
  margin-left: auto; background: #fff; border-radius: 999px; padding: 6px 14px;
  font-family: 'Fredoka'; font-weight: 500; color: var(--soft); font-size: .95rem;
}
.instr {
  display: flex; gap: 12px; align-items: center; background: #fff8e1; border-radius: 20px;
  padding: 12px 16px; margin-bottom: 18px; font-size: 1.2rem; border: 3px dashed #ffd166;
}

/* ---------- Word cards ---------- */
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.flip { perspective: 900px; height: 200px; cursor: pointer; }
.flip-inner { position: relative; height: 100%; transition: transform .6s cubic-bezier(.4,1.6,.5,1); transform-style: preserve-3d; }
.flip.on .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px; text-align: center; box-shadow: 0 6px 0 rgba(0,0,0,.08);
}
.face.front { background: #fff; }
.face.front .em { font-size: 4.2rem; }
.face.front small { color: var(--soft); font-family: 'Fredoka'; margin-top: 6px; }
.face.back { transform: rotateY(180deg); color: var(--ink); }
.face.back b { font-family: 'Fredoka'; font-size: 2rem; }
.face.back p { margin: 6px 0 8px; font-size: 1.05rem; line-height: 1.3; }

/* ---------- Look & find ---------- */
.find-wrap { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; align-items: start; }
.scene { width: 100%; display: block; border-radius: 24px; background: #fff4e3; }
.scene .item { transform-box: fill-box; transform-origin: center; }
.scene .item.pop { animation: popItem 1s ease; }
@keyframes popItem { 30% { transform: scale(1.45) rotate(-8deg); } 60% { transform: scale(1.2) rotate(6deg); } }
.scene-cap { text-align: center; color: var(--soft); margin: 10px 0 0; font-family: 'Fredoka'; }
.progress { height: 14px; background: #efeafc; border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--yellow)); border-radius: 99px; transition: width .4s; }
.qcount { font-family: 'Fredoka'; color: var(--soft); font-weight: 500; }
.question { display: flex; align-items: center; gap: 12px; font-size: 1.8rem; font-weight: 700; margin: 6px 0 10px; }
.opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  font-family: 'Andika'; font-size: 1.35rem; padding: 14px 18px; margin: 10px 0;
  border: 3px solid #e6dff9; border-radius: 18px; background: #fff; cursor: pointer;
  transition: transform .1s, background .2s;
}
.opt:hover { transform: translateX(4px); border-color: var(--sky); }
.opt .dot {
  width: 30px; height: 30px; border-radius: 50%; background: #f1edff; display: grid; place-items: center;
  font-family: 'Fredoka'; font-size: 1rem; color: var(--purple); flex-shrink: 0;
}
.opt.right { background: #d9f8ea; border-color: var(--green); }
.opt.right .dot { background: var(--green); color: #fff; }
.opt.wrong { background: #ffe3ea; border-color: var(--red); animation: shake .4s; }
.opt[disabled] { cursor: default; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
.next-row { display: flex; justify-content: flex-end; margin-top: 10px; min-height: 52px; }

/* ---------- Mini scenes ---------- */
.mini { position: relative; width: 120px; height: 100px; flex-shrink: 0; }
.mini span { position: absolute; left: 50%; transform: translateX(-50%); line-height: 1; white-space: nowrap; }
.mini .ref { bottom: 0; font-size: 60px; z-index: 2; }
.mini .obj { font-size: 34px; z-index: 3; }
.mini.on .obj { bottom: 54px; }
.mini.under .ref { bottom: 34px; font-size: 56px; }
.mini.under .obj { bottom: 0; font-size: 30px; }
.mini.in .obj { bottom: 30px; z-index: 1; }
.mini.next .ref { left: 36%; }
.mini.next .obj { left: 82%; bottom: 2px; }
.mini.behind .obj { bottom: 36px; z-index: 1; font-size: 40px; }
.mini.behind .ref { font-size: 66px; opacity: .92; }
.mini.big { width: 190px; height: 160px; }
.mini.big .ref { font-size: 96px; }
.mini.big .obj { font-size: 54px; }
.mini.big.on .obj { bottom: 86px; }
.mini.big.under .ref { bottom: 54px; font-size: 90px; }
.mini.big.under .obj { font-size: 48px; }
.mini.big.in .obj { bottom: 48px; }
.mini.big.behind .obj { bottom: 56px; font-size: 64px; }
.mini.big.behind .ref { font-size: 104px; }

/* ---------- Match ---------- */
.match { display: grid; grid-template-columns: 1fr 1.3fr; gap: 22px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.mcard {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 3px solid #e6dff9; background: #fff; border-radius: 20px; padding: 12px 16px;
  font-size: 1.3rem; cursor: pointer; min-height: 76px; transition: transform .12s;
  font-family: 'Andika'; font-weight: 700;
}
.mcard:hover { transform: scale(1.02); }
.mcard.sel { border-color: var(--purple); background: #f1edff; box-shadow: 0 0 0 5px rgba(123,108,246,.18); }
.mcard.done { cursor: default; color: #2c6b52; }
.mcard.wrong { animation: shake .4s; border-color: var(--red); }
.mcard .mini { width: 100px; height: 80px; transform: scale(.85); }
.mcard .tagno { font-family: 'Fredoka'; font-size: 1rem; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex-shrink: 0; }

/* ---------- Story ---------- */
.story-wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.story-banner {
  font-size: 2.6rem; text-align: center; background: linear-gradient(180deg, #ddd5c6, #f4ede1);
  border-radius: 20px; padding: 12px; letter-spacing: 8px; margin-bottom: 12px;
}
.story h3 { margin: 0 0 10px; font-size: 1.6rem; display: flex; align-items: center; gap: 10px; }
.story-text { font-size: 1.45rem; line-height: 2.1; }
.sent { padding: 3px 6px; border-radius: 10px; cursor: pointer; transition: background .3s; }
.sent:hover { background: #f1edff; }
.sent.reading { background: #d8ecff; }
.sent.hint { background: #fff066; box-shadow: 0 0 0 3px #ffd166; animation: glow 1s ease 2; }
@keyframes glow { 50% { background: #ffe14d; } }
.hint-btn { background: #fff3c4; color: #8a6400; box-shadow: 0 5px 0 #f1d27a; }

/* ---------- Quiz ---------- */
.quiz { max-width: 760px; margin: 0 auto; }
.quiz-pic { display: flex; justify-content: center; align-items: center; min-height: 170px; background: #f6f2ff; border-radius: 22px; margin: 8px 0 12px; }
.read-box {
  background: #fff8e1; border-left: 8px solid var(--yellow); border-radius: 16px; padding: 14px 18px;
  font-size: 1.4rem; display: flex; gap: 12px; align-items: center; margin: 10px 0;
}
.read-box .pic { font-size: 3.4rem; }
.score-dots { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.score-dots i { width: 18px; height: 18px; border-radius: 50%; background: #ece6fb; display: inline-block; }
.score-dots i.g { background: var(--green); }
.score-dots i.b { background: var(--red); }

/* ---------- Learnt ---------- */
.learnt { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.prompt { font-size: 1.6rem; font-weight: 700; margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 3px solid #e6dff9; background: #fff; border-radius: 999px; padding: 10px 16px; font-size: 1.1rem;
  cursor: pointer; font-family: 'Andika'; font-weight: 700;
}
.chip.on { background: var(--mint); border-color: #4fcfa5; }
.field { width: 100%; font: inherit; font-size: 1.3rem; padding: 12px 16px; border-radius: 16px; border: 3px solid #e6dff9; outline: none; margin: 6px 0 14px; }
.field:focus { border-color: var(--purple); }
.moods { display: flex; gap: 10px; flex-wrap: wrap; }
.mood { border: 3px solid #e6dff9; background: #fff; border-radius: 18px; padding: 10px 14px; cursor: pointer; font-size: 1.1rem; font-family: 'Fredoka'; }
.mood.on { border-color: var(--pink); background: #ffe8ef; }
.cert {
  text-align: center; background: radial-gradient(circle at top, #fffbe8, #fff); border-radius: 28px; padding: 26px;
  border: 6px dashed var(--yellow); position: relative;
}
.cert h2 { color: var(--purple); font-size: 2rem; margin: 6px 0; }
.cert .nm { font-family: 'Fredoka'; font-size: 2.2rem; color: var(--pink); margin: 4px 0; }
.cert p { font-size: 1.3rem; line-height: 1.5; }
.cert .medal { font-size: 4rem; }
.cert .sig { margin-top: 14px; font-family: 'Fredoka'; color: var(--soft); }

/* ---------- Overlay / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(61,53,83,.45); display: grid; place-items: center; z-index: 80; padding: 20px; }
.modal { background: #fff; border-radius: 32px; padding: 24px 30px; text-align: center; max-width: 480px; width: 100%; }
.modal h2 { margin: 6px 0; font-size: 1.8rem; }
.modal p { font-size: 1.2rem; margin: 4px 0 8px; }
.big-stars { font-size: 3.4rem; letter-spacing: 6px; color: #e8e2f7; margin: 6px 0 14px; }
.big-stars .on { color: #ffb703; display: inline-block; animation: starIn .5s both; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1); } }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pop-in { animation: popIn .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes popIn { from { transform: scale(.5); opacity: 0; } }

.cheer {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 90; pointer-events: none;
  font-family: 'Fredoka'; font-weight: 700; font-size: 2.4rem; padding: 14px 28px; border-radius: 999px;
  animation: cheer 1.1s ease forwards; box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.cheer.g { background: #d9f8ea; color: #1f8a5e; }
.cheer.b { background: #ffe3ea; color: #c23a5b; }
@keyframes cheer { 0% { transform: translate(-50%,-50%) scale(.4); opacity: 0; } 25% { transform: translate(-50%,-50%) scale(1.1); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%,-90%) scale(1); opacity: 0; } }

.confetti { position: fixed; top: -20px; width: 12px; height: 18px; z-index: 95; pointer-events: none; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  header.top { padding-right: 150px; }
  .tag { font-size: .9rem; padding: 5px 12px 5px 6px; }
  .tag .av { width: 26px; height: 26px; }
  .logo-txt b { font-size: 1.2rem; }
  .logo-txt small { display: none; }
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero svg { max-width: 180px; margin: 0 auto; }
  .tips { justify-content: center; }
  .find-wrap, .story-wrap, .match, .learnt { grid-template-columns: 1fr; }
  .question { font-size: 1.5rem; }
}

@media print {
  body * { visibility: hidden; }
  .cert, .cert * { visibility: visible; }
  .cert { position: absolute; left: 0; top: 0; width: 100%; }
}
