@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800;900&display=swap');

:root{
  --ink:#27314a;
  --muted:#69738d;
  --paper:#fffdf8;
  --white:#ffffff;
  --purple:#5b4fc8;
  --purple-dark:#463aa9;
  --lavender:#eeeaff;
  --yellow:#ffd85a;
  --yellow-soft:#fff4c8;
  --green:#52b788;
  --green-soft:#e8f8ef;
  --red:#ef6b73;
  --red-soft:#ffecee;
  --blue:#5aa7e8;
  --blue-soft:#eaf5ff;
  --shadow:0 16px 40px rgba(65,56,130,.14);
}

*{box-sizing:border-box}
body{
  margin:0;min-height:100vh;
  font-family:"Nunito",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at 15% 10%, #fff3bd 0, transparent 27%),
    radial-gradient(circle at 86% 22%, #e9e2ff 0, transparent 30%),
    linear-gradient(180deg,#f8fbff 0%,#fffaf1 100%);
  overflow-x:hidden;
}
button{font:inherit}
button:focus-visible{outline:4px solid rgba(91,79,200,.22); outline-offset:3px}

.bg-shape{position:fixed;border-radius:999px;filter:blur(1px);opacity:.6;z-index:-1}
.shape-1{width:180px;height:180px;background:#d9f4e7;left:-70px;top:52%}
.shape-2{width:220px;height:220px;background:#ffe4e6;right:-95px;bottom:-40px}

.app-shell{width:min(1060px,calc(100% - 28px));margin:0 auto;min-height:100vh;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;gap:14px;justify-content:space-between;padding:18px 4px 12px}
.brand{display:flex;align-items:center;gap:10px;font-size:1.05rem}
.brand img{width:46px;height:46px}
.brand div{display:flex;flex-direction:column;line-height:1.05}
.brand strong{font-weight:900}
.brand span{color:var(--purple);font-weight:800;margin-top:4px}
.top-actions{display:flex;align-items:center;gap:8px}
.score-pill{background:var(--white);border:2px solid #f5e4a7;border-radius:999px;padding:10px 16px;box-shadow:0 7px 20px rgba(80,70,40,.08);font-size:1.05rem}
.icon-btn{width:44px;height:44px;border:0;border-radius:14px;background:white;box-shadow:0 8px 20px rgba(50,50,90,.08);font-size:1.45rem;cursor:pointer}
.mini-btn{border:0;background:transparent;color:var(--muted);font-weight:800;font-size:.82rem;cursor:pointer;padding:8px}
.hidden{display:none!important}

main{flex:1;padding:8px 0 22px}
.screen{display:none;animation:fadeIn .3s ease}
.screen.active{display:block}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

.hero-card{
  min-height:510px;background:linear-gradient(135deg,#fffef8 0%,#f8f4ff 100%);
  border:1px solid rgba(91,79,200,.10);border-radius:34px;box-shadow:var(--shadow);
  padding:clamp(28px,5vw,62px);display:grid;grid-template-columns:1.25fr .75fr;
  align-items:center;overflow:hidden;position:relative;
}
.hero-card:after{content:"";position:absolute;width:360px;height:360px;border-radius:50%;background:rgba(255,216,90,.18);right:-80px;bottom:-120px}
.hero-copy{position:relative;z-index:1;max-width:680px}
.eyebrow{font-size:.78rem;letter-spacing:.12em;font-weight:900;color:var(--purple)}
.hero-copy h1{font-size:clamp(2.2rem,5vw,4rem);line-height:1.02;margin:13px 0 18px;letter-spacing:-.045em}
.hero-copy h1 span{color:var(--purple)}
.hero-copy p{font-size:1.18rem;color:var(--muted);max-width:580px;margin-bottom:28px}
.hero-mascot{width:min(100%,270px);justify-self:center;position:relative;z-index:1;filter:drop-shadow(0 16px 20px rgba(81,70,140,.15))}
.parent-note{margin-top:14px;padding:14px 18px;border-radius:18px;background:rgba(255,255,255,.7);color:var(--muted);font-size:.94rem;line-height:1.5}
.parent-note p{margin:4px 0}
.parent-note strong{color:var(--ink)}

.primary-btn,.secondary-btn{
  border:0;border-radius:16px;padding:13px 20px;font-weight:900;cursor:pointer;
  transition:transform .15s ease,box-shadow .15s ease,opacity .15s ease;
}
.primary-btn{background:var(--purple);color:white;box-shadow:0 8px 20px rgba(91,79,200,.25)}
.primary-btn:hover,.secondary-btn:hover:not(:disabled){transform:translateY(-2px)}
.primary-btn.big,.secondary-btn.big{padding:16px 24px;font-size:1.06rem;margin-right:8px}
.secondary-btn{background:var(--lavender);color:var(--purple-dark)}
.secondary-btn:disabled{opacity:.55;cursor:not-allowed}
.secondary-btn.small{padding:9px 12px;font-size:.86rem;border-radius:12px}

.map-head{display:flex;gap:20px;justify-content:space-between;align-items:flex-end;margin:12px 0 22px}
.map-head h2{font-size:2rem;margin:5px 0 0}
.overall-progress{width:min(330px,45vw)}
.overall-progress span{display:block;text-align:right;font-size:.9rem;font-weight:800;color:var(--muted);margin-bottom:7px}
.progress-track{height:10px;background:#e9eaf1;border-radius:999px;overflow:hidden}
.progress-track>div{height:100%;width:0;background:linear-gradient(90deg,var(--yellow),#ffb74d);border-radius:inherit;transition:width .35s ease}
.progress-track.large{height:12px;margin-bottom:18px}

.mission-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.mission-card{
  border:0;text-align:left;background:var(--white);border-radius:24px;padding:18px;min-height:190px;
  box-shadow:0 10px 26px rgba(72,68,120,.08);cursor:pointer;border:2px solid transparent;
  transition:.18s ease;position:relative;overflow:hidden;
}
.mission-card:hover{transform:translateY(-3px);border-color:#ddd6ff}
.mission-card.completed{background:linear-gradient(180deg,#ffffff,#f4fff8);border-color:#c8ecd8}
.mission-card .number{display:inline-flex;width:34px;height:34px;border-radius:11px;align-items:center;justify-content:center;background:var(--lavender);color:var(--purple);font-weight:900;margin-bottom:13px}
.mission-card .emoji{font-size:2.1rem;display:block;margin-bottom:8px}
.mission-card h3{font-size:1rem;margin:0 0 5px;line-height:1.1}
.mission-card p{font-size:.82rem;color:var(--muted);margin:0;line-height:1.35}
.mission-card .mission-stars{position:absolute;right:14px;top:14px;font-size:.83rem}
.mission-card.completed:after{content:"✓";position:absolute;right:14px;bottom:14px;width:27px;height:27px;border-radius:999px;display:grid;place-items:center;background:var(--green);color:white;font-weight:900}

.boss-card{margin-top:16px;background:linear-gradient(135deg,#352b82,#6758dc);color:white;border-radius:26px;padding:22px;display:grid;grid-template-columns:auto 1fr auto;gap:18px;align-items:center;box-shadow:0 13px 30px rgba(64,48,150,.2)}
.boss-card.locked{filter:saturate(.65);opacity:.78}
.boss-icon{font-size:2.5rem}
.boss-card h3{margin:4px 0}
.boss-card p{margin:0;color:#e8e4ff;font-size:.9rem}
.boss-card .eyebrow{color:#ffe481}

/* Story */
.story-shell{max-width:820px;margin:15px auto}
.story-top{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;margin-bottom:16px}
.story-top h2{margin:6px 0 0;font-size:2rem}
.story-step{background:white;border-radius:999px;padding:9px 14px;font-weight:900;color:var(--muted);box-shadow:0 6px 18px rgba(50,50,90,.07)}
.story-card{background:white;border-radius:30px;box-shadow:var(--shadow);padding:clamp(28px,5vw,52px);text-align:center;min-height:390px;display:flex;flex-direction:column;justify-content:center}
.story-emoji{font-size:4rem;margin-bottom:18px}
.story-scene-title{font-size:1.6rem;font-weight:900;color:var(--purple);margin-bottom:12px}
.story-text{font-size:1.32rem;line-height:1.6;margin:0 auto;max-width:680px}
.story-nav{display:flex;justify-content:space-between;gap:12px;margin-top:14px}

.quiz-top{display:flex;justify-content:space-between;align-items:flex-end;gap:18px;margin:12px 0}
.quiz-top h2{font-size:1.8rem;margin:5px 0 0}
.quiz-tools{display:flex;align-items:center;gap:8px}
.mission-label{font-size:.8rem;color:var(--purple);font-weight:900;letter-spacing:.08em}
.question-counter{background:white;border-radius:999px;padding:9px 14px;font-weight:900;color:var(--muted);box-shadow:0 6px 18px rgba(50,50,90,.07)}

.question-card{background:white;border-radius:28px;padding:clamp(22px,4vw,38px);box-shadow:var(--shadow);min-height:430px;display:flex;flex-direction:column;justify-content:center}
.question-visual{text-align:center;font-size:3.1rem;min-height:56px;margin-bottom:6px}
.question-visual .word{display:inline-block;font-size:2rem;font-weight:900;letter-spacing:.03em;color:var(--purple);background:var(--lavender);padding:9px 16px;border-radius:14px}
.question-prompt{text-align:center;font-size:clamp(1.3rem,3vw,1.7rem);line-height:1.25;font-weight:900;margin:8px auto 24px;max-width:760px}
.answer-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;max-width:850px;width:100%;margin:0 auto}
.answer-btn{min-height:86px;border:2px solid #e6e7ef;background:#fff;border-radius:18px;padding:14px 13px;font-weight:800;font-size:1.02rem;color:var(--ink);cursor:pointer;transition:.15s ease}
.answer-btn:hover:not(:disabled){transform:translateY(-2px);border-color:#beb6ff;background:#faf9ff}
.answer-btn.correct{background:var(--green-soft);border-color:var(--green);color:#28694a}
.answer-btn.wrong{background:var(--red-soft);border-color:var(--red);color:#9a3b45}
.answer-btn:disabled{cursor:default}
.feedback{max-width:850px;margin:16px auto 0;padding:13px 16px;border-radius:15px;text-align:center;font-weight:900}
.feedback.success{background:var(--green-soft);color:#28694a}
.feedback.error{background:var(--yellow-soft);color:#775c00}
.quiz-actions{text-align:right;margin-top:14px}

.celebration-card,.final-card{background:white;border-radius:34px;box-shadow:var(--shadow);text-align:center;padding:clamp(30px,5vw,56px);max-width:760px;margin:25px auto}
.complete-mascot{width:145px}
.confetti{font-size:1.5rem;letter-spacing:.6rem;margin-bottom:4px}
.celebration-card h2,.final-card h2{font-size:2.2rem;margin:8px 0}
.celebration-card p,.final-card p{color:var(--muted);font-size:1.05rem}
.earned-stars{font-size:2rem;letter-spacing:.15em;margin:20px 0}
.trophy{width:155px;filter:drop-shadow(0 12px 16px rgba(120,90,20,.16))}
.final-score{margin:22px auto;background:var(--yellow-soft);padding:18px;border-radius:20px;display:flex;flex-direction:column;gap:4px;max-width:390px}
.final-score strong{font-size:1.55rem;color:#755900}
.final-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}

footer{text-align:center;color:#777f94;font-size:.84rem;padding:12px 0 18px}
footer a{color:var(--purple-dark);font-weight:900;text-underline-offset:3px}
footer span{display:block;margin-top:5px}

@media (max-width:850px){
  .mission-grid{grid-template-columns:repeat(2,1fr)}
  .hero-card{grid-template-columns:1fr;min-height:auto}
  .hero-mascot{width:150px;margin-top:18px}
  .answer-grid{grid-template-columns:1fr}
}
@media (max-width:560px){
  .app-shell{width:min(100% - 18px,1060px)}
  .brand strong{font-size:.92rem}.brand span{font-size:.84rem}.brand img{width:38px;height:38px}
  .top-actions{gap:3px}.mini-btn{font-size:.72rem}.score-pill{padding:8px 11px}
  .hero-card{border-radius:26px;padding:28px 20px}
  .hero-copy h1{font-size:2.35rem}
  .hero-copy .primary-btn.big,.hero-copy .secondary-btn.big{display:block;width:100%;margin:8px 0 0}
  .parent-note{font-size:.85rem}
  .map-head,.story-top{align-items:flex-start;flex-direction:column}
  .overall-progress{width:100%}.overall-progress span{text-align:left}
  .mission-grid{grid-template-columns:1fr}
  .boss-card{grid-template-columns:auto 1fr}.boss-card button{grid-column:1/-1;width:100%}
  .question-card{border-radius:24px;padding:22px 16px}
  .question-prompt{font-size:1.28rem}
  .quiz-top{align-items:flex-start;flex-direction:column}
  .quiz-top h2{font-size:1.45rem}
  .quiz-tools{width:100%;justify-content:space-between}
  .story-card{min-height:350px;padding:28px 20px}
  .story-text{font-size:1.15rem}
  .story-emoji{font-size:3rem}
}
