/* Maths picture-book scenes. The game content still determines the board height. */
.math-scene,.nr-atlas,#aiStudio {
  --maple:linear-gradient(176deg,#fff0ac 0%,#f3bf67 9%,#e89e42 65%,#c47729 100%);
  --paper:linear-gradient(145deg,#fff9e8,#fff4d3 67%,#f4dfad);
  --ink:#182747;
}
.modal-box.wide:has(.math-scene),.modal-box.nrm:has(.nr-atlas) {
  width:min(1030px,100%); max-height:calc(100dvh - 22px);padding:0;
  overflow-y:auto;overflow-x:hidden;background:#f6dfa7;border-radius:25px;
}
.modal-box:has(.math-scene) .modal-x,.modal-box.nrm:has(.nr-atlas) .modal-x {
  top:12px;right:12px;width:46px;height:46px;border:2px solid white;color:#192951;background:#fff;box-shadow:0 3px 0 #bed1e0,0 4px 10px #18325366;
}
.math-scene {
  color:var(--ink);background:#986026;isolation:isolate;--activity-scene:url('./math-garden.webp');
}
.math-find {--activity-scene:url('./math-reef.webp')}
.math-trainer {--activity-scene:url('./math-workshop.webp')}
.math-banner,.nr-atlas .nr-scene {
  display:flex;flex-direction:column;align-items:flex-start;justify-content:center;
  min-height:clamp(136px,18vw,212px);padding:18px clamp(56px,8vw,112px) 18px clamp(15px,5vw,72px);
  background:#48a8d4 var(--activity-scene) center 49%/cover no-repeat;
  border:0;border-bottom:5px solid #985522;
}
.math-sign,#aiStudio .st-choose h2,#aiStudio .st-gal-h h2 {
  display:inline-block;box-sizing:border-box;width:fit-content;max-width:min(60%,640px);margin:0;
  padding:.18em .50em .28em;border:2px solid #924a16;border-radius:19px 14px 17px 11px;
  background:var(--maple);box-shadow:inset 0 3px 0 #ffed9c,inset 0 -4px 0 #bd792e,0 4px 0 #774119,0 8px 16px #47241066;
  text-align:center;color:#fffbed;font:700 clamp(1.55rem,3.65vw,3.3rem)/1.04 Fredoka,var(--head);
  text-shadow:0 2px #733919,1px 0 #733919,-1px 0 #733919,0 -1px #733919,0 4px 2px #68391d;
  text-wrap:balance;overflow-wrap:break-word;
}
.math-page {
  padding:clamp(12px,2.7vw,28px) clamp(14px,4vw,49px) clamp(18px,3vw,34px);
  border:clamp(4px,.7vw,8px) solid #c58a47;border-top:0;
  background:var(--paper);box-shadow:inset 0 0 0 2px #ffecbc;
}
.math-quiz-progress,.math-page .mg-prog,.math-page .mg-brain {
  display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 14px;
  padding:8px 16px;border-radius:999px;background:#fff;color:var(--ink);
  box-shadow:0 3px 0 #c9b387,0 4px 9px #b08c5f40;font:650 clamp(.9rem,2.2vw,1.15rem)/1.2 Fredoka,var(--head);
}
.math-quiz-progress>span,.math-page .mg-prog>span,.math-page .mg-brain>b{flex:none;white-space:nowrap}
.math-quiz-progress .mg-ladder{flex:1;gap:4px;margin:0}
.math-quiz-progress .mg-ladder i{height:clamp(8px,1.25vw,14px);border-radius:999px;background:#9ed0f1}
.math-quiz-progress .mg-ladder .cur{background:white;box-shadow:inset 0 0 0 2px #155de4}
.math-quiz-progress .mg-ladder .ok{background:#159153}
.math-quiz-progress .mg-ladder .no{background:repeating-linear-gradient(-45deg,#b42f47 0 3px,#f5acb3 3px 6px)}
.math-page .mg-bbar{min-width:25px}
.math-instructions{margin:0 0 12px;text-align:center;color:#384754;font:700 1rem/1.3 Nunito,sans-serif;text-wrap:balance}
.math-page .mg-qcard,.math-page .mg-ask {
  margin:0 0 16px;padding:clamp(13px,2.2vw,26px);background:#fffaf1e8;border:1px solid #d8b781;border-radius:16px;
}
.math-page .mg-qcard>b,.math-page .mg-ask>b{font:650 clamp(1.2rem,2.4vw,1.75rem)/1.2 Fredoka,var(--head);color:#15254a;text-wrap:balance}
.math-page .mg-vis,.math-page .mg-askv{line-height:1.3;overflow-wrap:anywhere}
.math-page .mg-vis .mg-emo,.math-page .mg-fishrow{white-space:normal;overflow-wrap:anywhere}
.math-page .mg-seq b{border:1px solid #e6cc9e}
.math-page .mg-opts,.math-page .mg-judge {gap:clamp(8px,1.5vw,14px)}
.math-page .mg-o,.math-page .mg-j,.nr-atlas .nr-go,.nr-atlas .nr-o {
  --face:#f35188;--foot:#b01051;--letters:#fff;
  margin:0;padding:.4em .7em;border:3px solid white;border-radius:999px;
  color:var(--letters);background:linear-gradient(var(--face),var(--foot));
  box-shadow:inset 0 3px 0 #ffffff59,inset 0 -4px 0 #692c1833,0 3px 0 #b38e60,0 6px 10px #633c2430;
  font:650 clamp(1.1rem,3vw,1.85rem)/1.12 Fredoka,var(--head);text-shadow:0 1px 2px #16233b69;
  min-height:52px;overflow-wrap:anywhere;
}
.math-page .mg-o:nth-child(2),.nr-atlas .nr-o.c1{--face:#298ef2;--foot:#1259bb}
.math-page .mg-o:nth-child(3),.nr-atlas .nr-o.c2{--face:#ffcd4c;--foot:#efa623;--letters:#482709;text-shadow:none}
.math-page .mg-o:nth-child(4),.math-page .mg-j.ok,.nr-atlas .nr-o.c3{--face:#259870;--foot:#096246}
.math-page .mg-o.ok,.math-page .mg-o.no,.nr-atlas .nr-o.ok,.nr-atlas .nr-o.no {
  opacity:1;border-color:white;
}
.math-page .mg-o.ok,.nr-atlas .nr-o.ok{outline:3px solid #16663d;outline-offset:1px}
.math-page .mg-o.no,.nr-atlas .nr-o.no{outline:3px dashed #9a2141;outline-offset:1px}
.math-page .mg-o.ok::after,.nr-atlas .nr-o.ok::after{content:" ✓"}
.math-page .mg-o.no::after,.nr-atlas .nr-o.no::after{content:" ×"}
.math-page .mg-j:disabled{opacity:.72}
.math-page .mg-j.on{opacity:1;outline:3px solid #55341f;outline-offset:2px}
.math-page .mg-robo{margin:16px auto 18px;max-width:700px}
.math-page .mg-think {min-width:0;overflow-wrap:anywhere;background:#f6fbff;border-color:#648bb4}
.math-page .mg-fb,.math-page .mg-fix{border:1px solid #d2bc96}
.math-page .mg-fb>div{min-width:0}
.math-find .mg-sea {
  background:linear-gradient(125deg,#326fa849,#407eaa33),url('./math-reef.webp') 50% 76%/cover no-repeat;
  border:3px solid #90ddeb;box-shadow:inset 0 0 17px #22617a55;padding:16px 12px;
}
.math-page .mg-bub {
  font-size:clamp(1.24rem,3.2vw,2rem);color:#132c50;text-shadow:0 1px 1px #fff;
  height:auto;min-width:0;width:min(84px,95%);transform:none;
  background:radial-gradient(circle at 29% 23%,#fff 0 7%,#effeffee 9% 25%,#cdf5f9ed 50%,#8ad7efde 75%,#d0faff 93%);
}
.math-page .mg-bub.pop{background:#ffe58d}.math-page .mg-bub.no {opacity:.6;text-decoration:line-through}
.math-find .mg-fish,.math-find .mg-weed{display:none}
.math-page :is(button,summary):focus-visible,.nr-atlas button:focus-visible,#aiStudio button:focus-visible {
  outline:3px solid #122d69;outline-offset:3px;box-shadow:0 0 0 3px white,0 0 0 6px #122d69;
}
body:has(.modal-box :is(.math-scene,.nr-atlas)) :is(#roboFab,#roboPeek),body:has(#aiStudio:not([hidden]):not(.st-inline)) :is(#roboFab,#roboPeek){visibility:hidden}
.nr-atlas {--activity-scene:url('./math-race.webp')}
.nr-atlas .nr-scene {aspect-ratio:auto;gap:12px;border-bottom-color:#26387c;background-position:50% 49%}
.nr-atlas .nr-sub {
  position:static;display:block;width:fit-content;max-width:46ch;height:auto;transform:none;border-radius:12px;
  padding:6px 11px;background:#151f47eb;color:#fff;font:750 clamp(.81rem,1.55vw,1.02rem)/1.26 Nunito,sans-serif;text-align:start;text-shadow:none;
}
.nr-atlas .nr-low {background:linear-gradient(150deg,#263778,#151f56)}
.nr-atlas .nr-low::before,.nr-atlas .nr-low::after {display:none}
.nr-atlas .nr-bars{margin:0 0 12px}
.nr-atlas .nr-q {border-radius:20px;border:3px solid #dfaf65;background:var(--paper);box-shadow:inset 0 0 0 2px #fff6d7,0 4px 9px #07133e66}
.nr-atlas .nr-q::before,.nr-atlas .nr-q::after,.nr-atlas .nr-opts::before,.nr-atlas .nr-opts::after{display:none}
.nr-atlas .nr-q>span,.nr-atlas .nr-ready,.nr-atlas .nr-cd {color:var(--ink);text-shadow:none}
.nr-atlas .nr-go {--face:#237fe2;--foot:#12499e}
.nr-atlas .nr-opts{padding:0}
.nr-atlas .nr-o{font-size:clamp(1.25rem,4.5vw,2.25rem);height:clamp(56px,7.4vw,78px)}
.nr-atlas .nr-o.no{filter:none}
.nr-atlas .nr-start p{line-height:1.3}
@media(max-width:600px){
  .modal-box.wide:has(.math-scene),.modal-box.nrm:has(.nr-atlas){max-height:calc(100dvh - 16px);border-radius:18px}
  .math-banner,.nr-atlas .nr-scene{padding:18px 49px 18px 13px;min-height:116px;background-position:62% 50%}
  .math-sign{max-width:75%;font-size:clamp(1.35rem,6.6vw,2rem)}
  .math-page{padding:12px 10px 18px}
  .math-quiz-progress,.math-page .mg-prog,.math-page .mg-brain{gap:7px;padding:9px 10px}
  .math-quiz-progress .mg-ladder{gap:2px}
  .math-page .mg-sea.cols8{grid-template-columns:repeat(4,minmax(0,1fr))}
  .math-page .mg-opts.three{grid-template-columns:repeat(3,minmax(0,1fr))}
  .math-find .mg-sea{gap:9px 4px;padding:13px 6px}
  .math-page .mg-fb{gap:8px}
  .nr-atlas .nr-sub{max-width:32ch;font-size:.79rem}
  .nr-atlas .nr-bars{gap:7px}
  .nr-atlas .nr-start p{font-size:.96rem}
}
@media(prefers-reduced-motion:reduce){.nr-atlas *,.math-scene *{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* Give the studio an illustrated entrance and keep the working canvas clear. */
#aiStudio .st-top {
  background:linear-gradient(110deg,#183b72 0%,#2a5689 55%,#194774 100%);border-bottom:3px solid #ddaf69;
}
#aiStudio .st-body:has(.st-choose),#aiStudio .st-body:has(.st-gal){
  background:linear-gradient(#fff1ca,#fff9ed 340px);
}
#aiStudio .st-choose,#aiStudio .st-gal {
  background:url('./game-sky-creative.webp') center top / 100% clamp(116px,17vw,205px) no-repeat;
  padding-top:clamp(28px,4.5vw,59px);
}
#aiStudio .st-choose h2,#aiStudio .st-gal-h h2 {
  max-width:min(75%,720px);margin:0 auto clamp(30px,5vw,74px);font-size:clamp(1.55rem,3vw,2.5rem);
}
#aiStudio .st-gal-h {text-align:center}
#aiStudio .st-chips {justify-content:center}
#aiStudio .st-card {color:var(--ink);background:var(--paper);border:3px solid #cd9a5b;overflow:hidden;padding:0 0 20px;box-shadow:0 5px 0 #b57a39,0 10px 20px #78502222}
#aiStudio .st-card p,#aiStudio .st-card h3{padding:0 14px;color:var(--ink);text-shadow:none}
#aiStudio .st-card p{font-size:1rem;line-height:1.35}
#aiStudio .st-c-art {height:auto;aspect-ratio:2.45;background-position:center;background-size:cover;flex:none}
#aiStudio .st-c-draw .st-c-art {background-image:url('./game-drawing.webp')}
#aiStudio .st-c-color .st-c-art {background-image:url('./game-coloring.webp')}
#aiStudio .st-c-art :is(img,span) {display:none}
#aiStudio .st-card .st-big {margin-top:auto}
#aiStudio .st-tcard {border:2px solid #dfbd8a;box-shadow:0 3px 0 #c9a26e,0 6px 14px #72461520}
#aiStudio .st-thumb {background:#fff;max-width:100%}
#aiStudio .st-ed{background:linear-gradient(145deg,#fcf3dd,#f2e0bc)}
#aiStudio .st-stage{border-color:#d39f60;box-shadow:0 0 0 1px #975e2e,0 5px 12px #72501e30}
#aiStudio :is(.st-tools,.st-side,.st-bar){background:#fffcf5;border:1px solid #dec79f}
#aiStudio .st-gt{color:#4e4235}
#aiStudio .st-tool[aria-pressed="true"],#aiStudio .st-tool.on{background:#e2efff;color:#103775}
#aiStudio .st-save{color:white;background:#166b48}
@media(max-width:600px){
  #aiStudio .st-choose,#aiStudio .st-gal{padding-top:27px}
  #aiStudio .st-choose h2,#aiStudio .st-gal-h h2{max-width:91%;margin-bottom:29px;font-size:clamp(1.3rem,5.6vw,1.7rem)}
  #aiStudio .st-c-art{aspect-ratio:2.8}
}
