
/* Text is drawn directly on the original artwork surfaces. */
body:has(#art-frame):is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active){
  background:#271734 var(--frame-art) center/cover no-repeat;
}
body:has(#art-frame):is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active)::before{
  background:#25173580;backdrop-filter:blur(26px);
}
body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::before,
body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::after{display:none}
body.cover-active #cover .cover-title{
  position:absolute;inset:11% 25% auto;height:15.5%;display:grid;place-items:center;
  padding:0;background:none;border:0;box-shadow:none;
}
body.cover-active #cover .cover-title span{
  display:block;max-width:100%;color:#ffdf67;text-align:center;
  font:950 clamp(.65rem,5cqw,5.25rem)/1.03 "Nirmala UI","Segoe UI",sans-serif;
  white-space:normal;overflow-wrap:anywhere;letter-spacing:normal;
  -webkit-text-stroke:.018em #8d273d;text-shadow:0 .06em #a13c39,0 .12em #501438,0 .16em .12em #291126;
}
body.cover-active #cover .cover-start span{
  display:grid;position:absolute;inset:12% 17% 18%;place-items:center;text-align:center;
  color:#551047;background:none;border:0;border-radius:0;text-shadow:0 .02em #fff0a7;
  font:950 clamp(.6rem,4.55cqw,4.8rem)/1.04 "Nirmala UI","Segoe UI",sans-serif;
  white-space:normal;overflow-wrap:anywhere;letter-spacing:normal;
}
#art-words .art-label{
  padding:.12em .18em;background:none;border:0;box-shadow:none;overflow:hidden;
  font-family:"Nirmala UI","Segoe UI",sans-serif;line-height:1.05;
}
.gate-active #art-words .art-prompt{inset:9.3% 36.8% auto;height:8%;min-height:0;font-size:clamp(.52rem,2.45cqw,2.6rem);color:#fff0af;text-shadow:0 .07em .1em #281129}
.cart-active #art-words .art-prompt{inset:8.8% 20.5% auto;height:14%;min-height:0;font-size:clamp(.6rem,5cqw,4.95rem);color:#ffeb7c;text-shadow:0 .06em #5f183f,0 .11em .08em #30142c}
.puppet-active #art-words .art-prompt{inset:11.5% 25% auto;height:11.2%;min-height:0;font-size:clamp(.55rem,4.35cqw,4.55rem);color:#68182d}
.rail-active #art-words .art-title{inset:15.5% 36% auto;height:8%;min-height:0;font-size:clamp(.7rem,2.35cqw,2.5rem);color:#760f20}
.rail-active #art-words .art-prompt{inset:30% 35% auto;height:7.8%;min-height:0;font-size:clamp(.52rem,3.25cqw,3.15rem);color:#63244a}
.wheel-active #art-words .art-title{inset:1% 34% auto;height:10.8%;min-height:0;font-size:clamp(.64rem,4.8cqw,5rem);color:#ffedb9;text-shadow:0 .075em #5d1535}
.wheel-active #art-words .art-prompt{inset:13% 34% auto;height:7.4%;min-height:0;font-size:clamp(.52rem,3.1cqw,3.3rem);color:#5f1b38}
.wheel-active #art-words .art-sweets{inset:37% 85% auto 3.4%;height:5.8%;color:#ffd66d}
.wheel-active #art-words .art-toys{inset:34.2% 1.9% auto 87%;height:6.5%;color:#ffd66d}
body.rail-active #gate-answers button,
body.rail-active:not([data-language=hi]) #gate-answers button{
  background:transparent!important;
  color:#4f192b;text-shadow:0 .04em #ffdf73;font:950 clamp(.65rem,3.1cqw,3.1rem)/1.05 "Nirmala UI","Segoe UI",sans-serif;
  padding:0 2.6cqw;overflow-wrap:anywhere;
}
body.rail-active #gate-answers button:last-child,
body.rail-active:not([data-language=hi]) #gate-answers button:last-child{
  background:transparent!important;color:#fff2ba;text-shadow:0 .065em #14513e;
}

.cover-start span{pointer-events:none}

/* Preserve the center artwork and extend only its outer scenery. */
body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::before,
body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::after{
  display:block;filter:none;transform:none;
}
@media (min-aspect-ratio:1672/941){
  body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::before,
  body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::after{
    width:calc((100vw - 100%) / 2 + 1px);background-size:833% 100%;
  }
  #art-frame::before{right:calc(100% - 1px);background-position:left center}
  #art-frame::after{left:calc(100% - 1px);background-position:right center}
}
@media (max-aspect-ratio:1672/941){
  body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::before,
  body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::after{
    height:calc((100dvh - 100%) / 2 + 1px);background-size:100% 833%;
  }
  #art-frame::before{background-position:center top}
  #art-frame::after{background-position:center bottom}
}
.topbar #full{white-space:nowrap;font-size:clamp(.72rem,1.1vw,1rem);padding-inline:8px}
#full-label{display:none}
.cover-active #full-label{display:inline}

/* Wide displays use a single panorama instead of repeated side slices. */
body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::before,
body:is(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame::after{display:none}
.cover-art{display:block;width:100%;height:100%}
@media(min-aspect-ratio:19/10){
  body.cover-active{--frame-art:url("../wide/opening-range.webp")}
  body.cover-active #art-frame{width:min(100vw,calc(100dvh * 1821 / 864));aspect-ratio:1821 / 864}
  body.cover-active #cover .cover-title{inset-inline:30%;height:15.5%}
  body.cover-active #cover .cover-title span{font-size:clamp(.65rem,4.4cqw,5.25rem)}
  body.cover-active #cover .cover-start{inset:74.9% 33.3% 5% 31.4%}
  body.cover-active #cover .cover-start span{font-size:clamp(.6rem,4.1cqw,4.8rem)}
}

/* Wide versions are separately composed at the projector's aspect ratio. */
@media(min-aspect-ratio:19/10){
  body:is(.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame{
    width:min(100vw,calc(100dvh * 1821 / 864));aspect-ratio:1821/864;
  }
  body.gate-active{--frame-art:url("../wide/level-one.webp")}
  body.cart-active{--frame-art:url("../wide/flower-cart.webp")}
  body.puppet-active{--frame-art:url("../wide/puppet-show.webp")}
  body.rail-active{--frame-art:url("../wide/mini-rail.webp")}
  body.wheel-active{--frame-art:url("../wide/big-wheel.webp")}
  .gate-open-picture{object-fit:cover!important}
  .gate-pane,.gate-lock,.cart-load,.puppet-dancers i,.rail-active .engine,.wheel-active .wheel-board::before{background-image:var(--frame-art)}
  .gate-active #art-words .art-prompt{inset:10% 39% auto;height:7%}
  .cart-active #art-words .art-prompt{inset:9% 27% auto;height:14%}
  .puppet-active #art-words .art-prompt{inset:10% 30% auto;height:11%}
  .rail-active #art-words .art-title{inset-block-start:16%}
  .rail-active #art-words .art-prompt{inset:29% 36% auto;height:9%}
  .wheel-active #art-words .art-title{inset:1% 36% auto;height:10%}
  .wheel-active #art-words .art-prompt{inset:12% 38% auto;height:7%}
  .wheel-active #art-words .art-sweets{inset:34.5% 77.5% auto 10%}
  .wheel-active #art-words .art-toys{inset:32% 8.5% auto 77.5%}
  .gate-active #gate-answers .choice{top:72%;height:21.5%;width:12.1%}
  .gate-active #gate-answers .choice:nth-child(1){left:30.5%}
  .gate-active #gate-answers .choice:nth-child(2){left:43.9%}
  .gate-active #gate-answers .choice:nth-child(3){left:57.3%}
  .gate-light,.gate-panes{clip-path:polygon(35% 68%,35% 43%,39% 34%,46% 29%,50% 23%,54% 29%,61% 34%,65% 43%,65% 68%)}
  .gate-lock{clip-path:inset(36% 46% 33% 46% round 4%)}
  .cart-active #gate-answers .choice{top:76%;height:20%;width:18%}
  .cart-active #gate-answers .choice:nth-child(1){left:17.3%}
  .cart-active #gate-answers .choice:nth-child(2){left:40.5%}
  .cart-active #gate-answers .choice:nth-child(3){left:64%}
  .cart-load{clip-path:polygon(34% 37%,35% 27%,65% 25%,70% 36%,69% 55%,35% 55%)}
  .cart-wheel{top:64.5%;width:10%;height:21%}
  .cart-wheel.rear{left:40%}.cart-wheel.front{left:61%}
  .puppet-active #gate-answers .choice{top:71.5%;height:21%;width:15.2%}
  .puppet-active #gate-answers .choice:nth-child(1){left:23.8%}
  .puppet-active #gate-answers .choice:nth-child(2){left:42.4%}
  .puppet-active #gate-answers .choice:nth-child(3){left:61%}
  .puppet-curtain{clip-path:polygon(24% 27%,76% 27%,78% 71%,23% 71%)}
  .puppet-dancers i:nth-child(1){clip-path:polygon(25% 68%,26% 48%,29% 33%,36% 33%,39% 44%,42% 52%,42% 71%,25% 71%);transform-origin:33% 70%}
  .puppet-dancers i:nth-child(2){clip-path:polygon(42% 71%,42% 49%,45% 33%,55% 33%,59% 47%,59% 71%);transform-origin:50% 70%}
  .puppet-dancers i:nth-child(3){clip-path:polygon(59% 71%,59% 49%,62% 43%,62% 28%,73% 28%,73% 48%,77% 50%,77% 71%);transform-origin:66% 70%}
  .rail-active #gate-answers button{top:71.5%;height:17%;width:24%}
  .rail-active #gate-answers button:first-child{left:24.5%}
  .rail-active #gate-answers button:last-child{left:51%}
  .rail-active .slot{left:var(--coach-wide-x);top:49%;width:12%;height:13.3%}
  .rail-active .engine{clip-path:polygon(68% 41%,76% 41%,76% 46%,81% 42%,83% 46%,86% 59%,87% 67%,68% 67%)}
  .rail-departure-backdrop{inset:43% 0 auto;height:23%}
  .wheel-active .wheel-board{transform-origin:49.2% 51.6%}
  .wheel-active .wheel-board::before{clip-path:ellipse(16.1% 33% at 49.2% 51.6%)}
  .wheel-active .bulb{left:var(--wide-x);top:var(--wide-y);width:5.6%;height:11.5%}
}


/* Align screen four's live controls with the printed button faces. */
@media(min-aspect-ratio:19/10){
  .rail-active #gate-answers button{top:81.5%;height:14.9%;width:23.7%;line-height:1.05;display:grid;place-items:center}
  .rail-active #gate-answers button:first-child{left:24.9%}
  .rail-active #gate-answers button:last-child{left:51.9%}
  .rail-active #art-words .art-prompt{inset-inline:39%;font-size:clamp(.55rem,2.25cqw,2.4rem)}
}
/* The operating ride replaces the original illustration with a clean set. */
.ride-show{display:none;position:absolute;inset:0;pointer-events:none}
.wheel-solved .ride-show{display:block}
.wheel-solved .wheel-board{display:none}
.ride-show picture,.ride-show picture img{position:absolute;inset:0;width:100%;height:100%;display:block;object-fit:fill}
.ride-stand{position:absolute;top:51%;left:50%;height:45%;width:19%;transform:translateX(-50%);
  clip-path:polygon(44% 0,56% 0,97% 100%,73% 100%,50% 20%,27% 100%,3% 100%);
  background:repeating-linear-gradient(148deg,#f38737 0 15px,#ef5c87 16px 28px,#9c265a 30px 45px);filter:drop-shadow(0 .5cqw .28cqw #75334f)}
.ride-ring{position:absolute;top:52.5%;left:50%;height:61%;aspect-ratio:1;border:clamp(4px,.75cqw,15px) solid #ed597f;
  border-radius:50%;box-shadow:0 0 0 .2cqw #f6b855,inset 0 0 0 .2cqw #f6b855;
  animation:ride-rotate 9s linear infinite;transform:translate(-50%,-50%)}
.ride-spoke{position:absolute;left:50%;top:50%;height:50%;width:3.2%;transform-origin:50% 0;transform:translateX(-50%) rotate(var(--angle));
  background:linear-gradient(90deg,#a84865,#fb9d39 25%,#ffd06a 65%,#d66449);border-radius:10px}
.ride-light{position:absolute;top:86%;left:50%;width:260%;aspect-ratio:1;transform:translate(-50%,-50%);border-radius:50%;
  background:radial-gradient(circle,#fff8cd 6%,#ffde67 55%,#fc922d 82%);border:.16cqw solid #ffedac;box-shadow:0 0 1.25cqw #ffcf67}
.ride-carrier{position:absolute;left:50%;top:99%;width:660%;transform:translateX(-50%) rotate(var(--angle-back));transform-origin:50% 5%;animation:ride-upright 9s linear infinite}
.ride-carrier img{display:block;width:100%;height:auto;filter:hue-rotate(var(--cabin-hue)) drop-shadow(0 .15cqw .12cqw #67364d)}
.ride-hub{position:absolute;left:50%;top:52.5%;width:6.1%;aspect-ratio:1;transform:translate(-50%,-50%);
  border-radius:50%;border:.32cqw solid #ffdc7d;background:radial-gradient(circle,#fff0a1 0 16%,#e94f85 17% 47%,#a72258 48% 73%,#f4a850 74%);box-shadow:0 .15cqw .55cqw #873958}
@keyframes ride-rotate{to{transform:translate(-50%,-50%) rotate(360deg)}}
@keyframes ride-upright{to{transform:translateX(-50%) rotate(calc(var(--angle-back) - 360deg))}}
@media(prefers-reduced-motion:reduce){.ride-ring,.ride-carrier{animation:none}.ride-hub{box-shadow:0 0 1.35cqw #ffcf67}}
.wheel-active #art-words .art-prompt{inset-inline:37%}

.wheel-solved .wheel-picture{visibility:hidden}

/* Leave the title's decorative flourishes outside the lettering. */
body.cover-active #cover .cover-title{inset-inline:29%;white-space:nowrap}
body.cover-active #cover .cover-title span{font-size:clamp(.58rem,3.7cqw,4.15rem);white-space:nowrap}
@media(min-aspect-ratio:19/10){
  body.cover-active #cover .cover-title{inset-inline:32%}
  body.cover-active #cover .cover-title span{font-size:clamp(.58rem,3.35cqw,4rem)}
}

/* Navigation stays apart and leaves the center of the scene open. */
body:is(.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #game #controls{
  position:fixed;inset:auto 2.2% 3% 2.2%;display:flex;justify-content:space-between;
  width:auto;max-width:none;transform:none;background:none;border:0;padding:0;pointer-events:none;
}
#controls #previous,#controls #next{pointer-events:auto}
#controls #next{margin-inline-start:auto}
body:not(.cover-active,.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #controls{
  width:min(100%,720px);justify-content:space-between;background:none;border:0
}

/* Small decorative navigation plaques with live translated labels. */
#controls #previous,#controls #next{
  display:flex;align-items:center;justify-content:center;gap:.24em;
  width:clamp(96px,9.4vw,165px);min-height:46px;height:clamp(46px,3.9vw,70px);
  padding:0 clamp(9px,1.1vw,20px);border:0;border-radius:29%;
  background:transparent url("../navigation-plaque.webp") center/100% 100% no-repeat;
  box-shadow:none;color:#ffefbe;text-shadow:0 1px 2px #361130;
  font-size:clamp(.72rem,1.2vw,1.18rem);line-height:1.04;text-align:center;overflow-wrap:anywhere
}
#controls #next::after{content:" →";flex-shrink:0}
#controls #previous:hover,#controls #next:hover{filter:brightness(1.15)}
#controls #previous:focus-visible,#controls #next:focus-visible{outline-offset:1px}
@media(max-width:470px){
  #controls #previous,#controls #next{width:84px;padding-inline:7px;font-size:.72rem}
}


/* Flower cart runs on a separate illustrated fairground, with rolling wooden wheels. */
.cart-finish-scene{display:none;position:absolute;inset:0;isolation:isolate;pointer-events:none}
.cart-solved .cart-finish-scene{display:block}
.cart-solved .cart-picture{visibility:hidden;animation:none}
.cart-road{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center}
.cart-moving-group{position:absolute;left:26%;top:28%;width:47%;height:48%;isolation:isolate;
  animation:flower-cart-travel 2.8s .55s cubic-bezier(.33,.05,.3,1) both}
.cart-ground-shadow{position:absolute;left:3%;right:1%;bottom:1%;height:5%;border-radius:50%;background:#47223b8c;filter:blur(.46cqw)}
.cart-sprite{position:absolute;left:0;top:0;width:100%;height:72%;object-fit:contain;z-index:2;
  animation:flower-cart-bob .5s .55s ease-in-out 5 alternate}
.cart-spoked-wheel{position:absolute;top:54%;width:25%;height:44%;object-fit:contain;z-index:1;
  animation:flower-cart-spin .92s .55s linear 3 both;transform-origin:center}
.cart-spoked-wheel.rear{left:9%}
.cart-spoked-wheel.front{right:9%}
.cart-solved #art-words .art-prompt{inset-inline:23%;text-shadow:0 .07em #562038,0 .12em .2em #29102d}
@keyframes flower-cart-travel{to{transform:translateX(40%)}}
@keyframes flower-cart-bob{to{transform:translateY(-1.8%) rotate(.45deg)}}
@keyframes flower-cart-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.cart-moving-group,.cart-sprite,.cart-spoked-wheel{animation:none}}


/* Keep the completed rides in view while showing more of their movement. */
.cart-moving-group{animation-duration:3.4s}
.cart-spoked-wheel{animation-iteration-count:4;animation-duration:.85s}
@keyframes flower-cart-travel{to{transform:translateX(54%)}}
.rail-finish-picture,.rail-finish-picture img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none}
.rail-finish-picture{visibility:hidden}
.rail-solved .rail-finish-picture{visibility:visible}
.rail-solved .rail-picture{visibility:hidden}
.rail-active .train{transform-origin:0 67%}
.rail-active .train.depart{transform:none;transition:none;animation:rail-cross-platform 3.2s both cubic-bezier(.24,.04,.27,1)}
@keyframes rail-cross-platform{
  from{transform:translateX(0)}
  to{transform:translateX(4.5%)}
}
#controls #previous,#controls #next{
  width:clamp(122px,12.2vw,220px);height:clamp(51px,5.05vw,91px);
  font-size:clamp(.82rem,1.46vw,1.42rem)
}
@media(max-width:470px){
  #controls #previous,#controls #next{width:100px;height:48px;font-size:.76rem}
}
@media(prefers-reduced-motion:reduce){.rail-active .train.depart{transform:none;transition:none;animation:none}}

.rail-finish-picture{object-fit:cover;object-position:center}
.rail-solved #art-words .art-title{inset:3% 38% auto;height:7%}
.rail-solved #art-words .art-prompt{inset:78.5% 32% auto;height:6.5%;font-size:clamp(.65rem,1.85cqw,2rem)}


.rail-active .train.depart::after{
  content:"";position:absolute;left:85.4%;top:40.3%;width:5%;height:5%;border-radius:50%;
  background:radial-gradient(ellipse at 70% 63%,#f7d8e4 0 20%,transparent 58%),radial-gradient(ellipse at 35% 40%,#ffe4db 0 23%,transparent 66%);
  animation:rail-steam 1.05s ease-out 3 both;pointer-events:none
}
@media(min-aspect-ratio:19/10){.rail-active .train.depart::after{left:78.5%;top:39%}}
@keyframes rail-steam{from{transform:translate(3%,20%) scale(.55);opacity:.9}to{transform:translate(-48%,-110%) scale(1.3);opacity:0}}
@media(prefers-reduced-motion:reduce){.rail-active .train.depart::after{display:none}}

/* The train and wagon re-enter only after the entire vehicle leaves the frame. */
.rail-active .train.depart{animation:rail-platform-loop 12s linear infinite}
.cart-solved .cart-moving-group{animation:flower-cart-loop 10s .55s linear infinite both}
.cart-solved .cart-spoked-wheel{animation:flower-cart-spin .9s .55s linear infinite}
.cart-solved .cart-sprite{animation:flower-cart-bob .55s .55s ease-in-out infinite alternate}
.rail-active .train.depart::after{animation:rail-steam 1.05s ease-out infinite}
@keyframes rail-platform-loop{
  0%,100%{transform:translateX(0)}
  49.999%{transform:translateX(101%)}
  50%{transform:translateX(-101%)}
}
@keyframes flower-cart-loop{
  0%,100%{transform:translateX(0)}
  49.999%{transform:translateX(76cqw)}
  50%{transform:translateX(-76cqw)}
}
@media(prefers-reduced-motion:reduce){
  .rail-active .train.depart,.cart-solved .cart-moving-group,.cart-solved .cart-spoked-wheel,.cart-solved .cart-sprite{animation:none}
}

/* Interactive stalls for 6–10. */
body.count-active{overflow:hidden;background:#271740;padding:0}
body.count-active::before{background:radial-gradient(ellipse,#553053,#21142f)}
body.count-active #art-frame{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100vw,calc(100dvh * 1821 / 864));aspect-ratio:1821 / 864;display:block;container-type:inline-size;isolation:isolate}
.count-active .topbar{position:fixed;z-index:5;inset:8px 12px auto auto;display:block;min-height:0}
.count-active .identity,.count-active #levels,.count-active .heading h1{display:none}
.count-active #scene{position:fixed;inset:0;width:100%;height:100%;display:block;border:0;border-radius:0;background:#43295f;box-shadow:none}
.count-active #scene::before{display:none}
.count-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none}
.count-board{position:absolute;inset:10% 19% 13%;display:grid;grid-template-rows:auto minmax(0,1fr) auto;justify-items:center;gap:2%}
.count-board h2{margin:0;padding:.19em .75em;border-radius:.45em;background:#ffedb9;color:#602248;font-size:clamp(.78rem,2.65cqw,2.8rem);line-height:1.03;text-align:center}
.count-grid{width:min(100%,850px);display:grid;grid-template-columns:repeat(var(--columns),minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:clamp(3px,1cqw,15px)}
.count-item{position:relative;min-height:0;min-width:0;padding:2px;display:grid;place-items:center;border:1px solid #f3c57f9c;border-radius:18%;background:#39234fdb;box-shadow:0 .2cqw .45cqw #20142c88;touch-action:manipulation}
.count-item[aria-pressed=true]{background:#1d6c51;border-color:#b4f2b4}
.count-tag{position:absolute;right:5%;top:4%;font-size:clamp(.62rem,1.55cqw,1.6rem);background:#ffe782;color:#49204e;border-radius:50%;min-width:1.3em}
.count-tag:empty{display:none}
.count-tally{color:#3c1f46;font-weight:950;font-size:clamp(.56rem,1.7cqw,1.8rem);background:#ffdf83;border-radius:100px;padding:.12em .74em}
.count-active .heading{position:fixed;z-index:3;inset:auto 20% 3% 20%;max-width:none;background:#361f4be8;pointer-events:none;padding:.33em .7em}
.count-active .heading #message{margin:0;font-size:clamp(.5rem,1.55cqw,1.55rem)}
.count-active #controls{position:fixed;z-index:4;inset:auto 2% 2%;width:auto;max-width:none;display:flex;background:none;border:0;justify-content:space-between;pointer-events:none}
.count-token{display:grid;place-items:center;position:relative;width:min(72%,7.2cqw);aspect-ratio:1;font-size:clamp(.95rem,5.2cqw,5.35rem);line-height:1;filter:drop-shadow(0 .15cqw .16cqw #1e142a99)}
.count-item-7 .count-token{width:min(65%,6.2cqw);background:radial-gradient(circle at 28% 24%,#ffe291,#f4a53b 61%,#bb552a);border-radius:50%;border:.12cqw solid #ffcf77}
.count-item-9 .count-token{background:conic-gradient(#ec6793 0 25%,#65cacc 25% 50%,#ffbf5a 50% 75%,#ac8cea 75%);clip-path:polygon(50% 0,73% 27%,100% 50%,71% 74%,50% 100%,28% 73%,0 50%,27% 26%);transform:rotate(16deg)}
.count-item-10 .count-token{width:min(53%,4.55cqw);height:65%;background:repeating-linear-gradient(90deg,#a13861 0 10%,#ed9a54 11% 24%,#ffdc80 25% 30%);border-radius:22%;border:.25cqw solid #ffb85c}
.count-item-10 .count-token::before,.count-item-10 .count-token::after{content:"";position:absolute;left:-10%;right:-10%;height:12%;border-radius:8px;background:#fabe60}
.count-item-10 .count-token::before{top:-6%}.count-item-10 .count-token::after{bottom:-6%}
.ticket-booth .review-icon{width:clamp(27px,6.6vw,91px)}

/* Each newer stall has its own play surface and illustrated objects. */
.count-board{inset:10% 20% 13%;grid-template-rows:auto minmax(0,1fr) auto}
.count-grid{grid-template-rows:repeat(var(--rows),minmax(0,1fr));position:relative;isolation:isolate;gap:.6cqw 1.15cqw}
.count-item{background:none;border:0;box-shadow:none;border-radius:10px;min-height:0;overflow:visible;display:grid;place-items:center;padding:0}
.count-item:hover{filter:none}
.count-item[aria-pressed=true]{background:none;border:0}
.activity-object{width:80%;height:96%;max-height:100%;object-fit:contain;pointer-events:none;filter:drop-shadow(0 .18cqw .2cqw #1e0e2990)}
.count-item .count-tag{background:#fff0a8;box-shadow:0 .14cqw .24cqw #321b42a0;z-index:2}
.count-workbench{display:flex;align-items:center;justify-content:center;gap:1cqw}
.count-add{background:linear-gradient(#ffeca1,#efa642);color:#55234f;border:2px solid #ffe7a1;min-height:0;font-size:clamp(.57rem,1.55cqw,1.65rem);padding:.28em .65em}
.count-add:disabled{opacity:.6}
.activity-6 .count-grid{padding:0 5%;background:repeating-linear-gradient(to bottom,#482446 0 42%,#82503d 43% 46%,#dda45f 47% 49%,#6e443e 50%);border:.45cqw solid #d08b4e;border-radius:10px}
.activity-7 .count-grid{width:76%;padding:.55cqw 3%;background:radial-gradient(ellipse,#e4a544,#996125);border:.45cqw solid #f5d176;border-radius:35% 35% 30% 30%;box-shadow:0 .35cqw .6cqw #2b133e99}
.activity-7 .activity-object{width:65%}
.activity-6 .count-item:not([data-placed]) .activity-object,.activity-7 .count-item:not([data-placed]) .activity-object,.activity-8 .count-item:not([data-placed]) .activity-object{opacity:.27;filter:grayscale(.65)}
.activity-6 .count-item[data-placed] .activity-object,.activity-7 .count-item[data-placed] .activity-object,.activity-8 .count-item[data-placed] .activity-object{animation:stall-place .35s ease-out both}
@keyframes stall-place{from{opacity:0;transform:translateY(-26%) scale(.78)}}
.activity-8 .count-grid{background:linear-gradient(transparent 24%,#e1ab6e 24.5% 25%,transparent 25.5% 74%,#e1ab6e 74.5% 75%,transparent 75.5%)}
.activity-8 .count-item:nth-child(even) .activity-object{filter:hue-rotate(17deg) drop-shadow(0 .18cqw .2cqw #1e0e2990)}
.activity-8.activity-complete .count-grid{animation:garland-sway 1.2s ease-in-out 3 alternate;transform-origin:50% 0}
@keyframes garland-sway{to{transform:rotate(2.1deg)}}
.activity-9 .count-grid{width:65%}
.activity-9 .count-item::before{content:"";position:absolute;left:49%;top:48%;height:49%;width:3%;border-radius:2px;background:#f9ce76;z-index:-1}
.activity-9 .activity-object{width:65%;height:82%;align-self:start}
.activity-9 .count-item[data-placed] .activity-object{animation:stall-spin 1.3s linear infinite}
@keyframes stall-spin{to{transform:rotate(360deg)}}
.activity-10 .count-grid{background:linear-gradient(transparent 13%,#efd092 13.5% 14%,transparent 14.5% 63%,#efd092 63.5% 64%,transparent 64.5%)}
.activity-10 .count-item:not([data-placed]) .activity-object{filter:brightness(.52) saturate(.73)}
.activity-10 .count-item[data-placed] .activity-object{filter:brightness(1.21) drop-shadow(0 0 1.15cqw #ffb644)}
.activity-10.activity-complete .count-grid{background-color:#d88c2733;border-radius:24px}
@media(prefers-reduced-motion:reduce){.activity-9 .count-item[data-placed] .activity-object{animation:none;filter:brightness(1.22)}}


/* Separate navigation and narration on the counting stalls. */
body.count-active #game #controls{
  position:fixed;inset:auto 2.2% 3% 2.2%;width:auto;max-width:none;margin:0;
  padding:0;justify-content:space-between;transform:none;
}
body.count-active #game .heading{
  inset:auto max(23%,110px) 3.4%;margin:0;max-width:none;
}
@media(max-width:520px){
  body.count-active #game .heading{inset:auto 12% 20%}
}

.activity-6 .count-grid{width:86%;padding:0 4%;gap:.5cqw 1.65cqw}
.activity-6 .count-item:not([data-placed])::before{
  content:"";position:absolute;inset:11% 13% 10%;border:2px dashed #ffd98cbb;border-radius:23% 23% 40% 40%;
}
.activity-6 .count-item:not([data-placed]) .activity-object{visibility:hidden}
.activity-6 .count-workbench{gap:1.25cqw}
.water-choices{display:flex;gap:.72cqw}
.water-choices .choice{width:clamp(36px,5.3cqw,105px);height:clamp(30px,3.6cqw,72px);min-width:0;min-height:0;padding:0;font-size:clamp(.84rem,2.2cqw,2.3rem)}
.water-choices.placing .choice:not(.correct){opacity:.38}
.water-seller{position:absolute;z-index:2;left:92%;bottom:7%;width:34%;display:none;pointer-events:none}
.water-seller img{display:block;width:100%;height:auto}
.activity-6.activity-complete .water-seller{display:block;animation:stall-place .38s ease-out both}
.water-seller i{position:absolute;left:83.5%;top:70%;width:2.7%;height:6.4%;border-radius:80%;background:linear-gradient(90deg,#c6f9ff,#48c0e2,#baf4ff);transform-origin:top;animation:water-pour 1.45s .22s ease-in-out 1 both}
@keyframes water-pour{0%,100%{transform:scaleY(.12);opacity:0}25%,76%{transform:scaleY(1);opacity:.88}}
@media(prefers-reduced-motion:reduce){.water-seller i{animation:none;display:none}}



.activity-6 .count-grid{width:94%;padding-inline:2%;column-gap:1.2cqw}
.activity-6 .activity-object{
  position:absolute;
  inset:auto 13% 6%;
  width:74%;
  height:80%;
  object-position:center bottom;
}
.activity-6 .count-item:not([data-placed])::before{inset:14% 13% 6%}
.activity-6 .water-seller{left:96%;bottom:7%;width:23%}



/* Place value activities 11–100. Each tray always contains ten sweets. */
.topbar #number-picker{max-width:94px;font-weight:800;font-size:clamp(.7rem,1vw,1rem)}
body.value-active{overflow:hidden;background:#291b42;padding:0}
body.value-active::before{background:radial-gradient(ellipse,#603454,#241533)}
body.value-active #art-frame{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100vw,calc(100dvh * 1821 / 864));aspect-ratio:1821 / 864;display:block;container-type:inline-size;isolation:isolate}
.value-active .topbar{position:fixed;z-index:5;inset:7px 11px auto auto;display:block;min-height:0}
.value-active .identity,.value-active #levels,.value-active .heading h1{display:none}
.value-active #scene{position:fixed;inset:0;width:100%;height:100%;display:block;border:0;border-radius:0;box-shadow:none;background:#372249 url("../counting/place-value-counter.webp") center/contain no-repeat}
.value-active #scene::before{display:none}
.value-board{position:absolute;inset:6% 14% 15%;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:2%;justify-items:center}
.value-progress,.value-equation{margin:0;padding:.1em .75em;border-radius:999px;color:#5a1c42;background:#ffdf84;font-weight:950;font-size:clamp(.6rem,1.85cqw,2rem)}
.value-groups{width:100%;min-height:0;display:grid;grid-template-columns:2fr 1fr;gap:2%;direction:ltr}
.value-groups section{min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);border-radius:1cqw;border:1px solid #ddb987;background:#301b46e6}
.value-groups h2{margin:.2em 0 .08em;color:#ffe59b;font-size:clamp(.65rem,2cqw,2.1rem)}
.value-tens,.value-ones{min-height:0;display:grid;align-items:center;padding:1cqw;gap:.4cqw}
.value-tens{grid-template-columns:repeat(5,minmax(0,1fr));grid-auto-rows:minmax(0,1fr)}
.value-ones{grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);color:#ffecb1;font-size:clamp(.7rem,2.2cqw,2.4rem);font-weight:900}
.value-tray{height:min(100%,7cqw);min-height:0;position:relative;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:2%;padding:5.5% 5.5% 14%;border-radius:18%;border:.12cqw solid #f8d588;background:linear-gradient(#f5c66d,#995834);box-sizing:border-box}
.value-tray img,.value-ones img{width:100%;height:100%;min-width:0;min-height:0;object-fit:contain}
.value-ones img{max-height:3.8cqw}
.value-tray b{position:absolute;bottom:0;left:50%;transform:translateX(-50%);font-size:clamp(.45rem,1.02cqw,1rem);line-height:1.02;color:#fff1b6;background:#5b2b52;border-radius:.4em;padding:0 .24em}
.value-choices{display:flex;gap:1cqw}
.value-choices .choice{min-width:clamp(40px,7.4cqw,145px);min-height:0;padding:.12em .3em;font-size:clamp(.75rem,2.4cqw,2.5rem)}
.value-solved .value-groups section{border-color:#c4eea2}
.value-active #game .heading{position:fixed;z-index:3;inset:auto max(20%,98px) 3%;margin:0;padding:.25em .6em;max-width:none;background:#312145ed;pointer-events:none}
.value-active .heading #message{margin:0;font-size:clamp(.5rem,1.37cqw,1.5rem)}
body.value-active #game #controls{position:fixed;z-index:4;inset:auto 2% 3%;width:auto;max-width:none;display:flex;justify-content:space-between;background:none;border:0;pointer-events:none;padding:0;margin:0}
@media(max-width:520px){
  .value-active #game .heading{inset:auto 22% 5%;padding:.08em .18em}
  .value-board{inset:18% 9% 20%}
  body.value-active #game #controls button{width:58px;min-height:32px;height:32px;font-size:.53rem}
  .topbar #number-picker{max-width:60px;padding-inline:3px}
}

/* A compact place-value counter with real illustrated brass trays. */
.value-active #scene{background-image:url("../counting/place-value-counter.webp")}
.value-board{inset:5.5% 12% 15%;gap:1.6%;grid-template-rows:auto minmax(0,1fr) auto auto}
.value-progress{padding:.1em .65em;background:#4b224ceb;border:1px solid #e8bc71;color:#ffedb3;font-size:clamp(.58rem,1.38cqw,1.45rem)}
.value-groups{width:100%;grid-template-columns:minmax(0,1.65fr) minmax(0,1fr);gap:2.25cqw}
.value-groups section{align-self:center;height:83%;border:0;background:none;grid-template-rows:auto minmax(0,1fr)}
.value-groups h2{justify-self:center;margin:0;padding:.2em 1.15em;border:1px solid #ffe0a0;border-radius:999px;background:#52254ae8;color:#fff0a5;text-shadow:0 .07em .16em #301132}
.value-tens,.value-ones{
  display:flex;align-content:center;align-items:center;justify-content:center;flex-wrap:wrap;
  gap:.75cqw;padding:.45cqw .7cqw;min-width:0;min-height:0
}
.value-tens{border-bottom:2px solid #ffdea786}
.value-ones{border-bottom:2px solid #ffdea786}
.value-tens .value-tray{
  flex:0 0 calc((100% - (var(--tray-columns) - 1) * .75cqw) / var(--tray-columns));
  height:auto;max-width:19cqw;max-height:8cqw;aspect-ratio:2.08;
  padding:8% 7% 12%;box-sizing:border-box;border:0;border-radius:0;
  background:transparent url("../counting/objects/brass-tray.webp") center/100% 100% no-repeat;
  filter:drop-shadow(0 .45cqw .48cqw #32121c80);
}
.value-tens .value-tray{padding:clamp(3px,.52cqw,10px) clamp(4px,.72cqw,14px) clamp(5px,.85cqw,17px)}
.value-tens.one-tray .value-tray{max-width:17.5cqw;max-height:10cqw}
.value-tray img,.value-ones img{filter:drop-shadow(0 .1cqw .13cqw #48212a90)}
.value-tray b{bottom:4%;background:#592747;font-size:clamp(.45rem,1.1cqw,1.12rem)}
.value-ones img{flex:0 0 min(23%,4.25cqw);width:min(23%,4.25cqw);height:4.25cqw;max-height:none}
.value-ones.zero-ones{font-size:clamp(.9rem,4cqw,4rem);color:#fff0ac;text-shadow:0 .07em .15em #5f2640}
.value-equation{border:1px solid #b7f1c1;background:#1b674ce8;color:#fff3b8}
.value-choices .choice{min-width:clamp(44px,7.7cqw,145px);border:2px solid #ffe3a4;background:linear-gradient(#a03b7d,#652653);color:#fff4c8;box-shadow:0 .16cqw 0 #42214a}
.value-choices .choice.correct{border-color:#b8eea7;background:linear-gradient(#36926b,#1f633f);opacity:1}
.value-choices .choice:disabled:not(.correct){opacity:.4}
.value-active #game .heading{inset:auto max(21%,100px) 3%;border:0;background:#3d203ca8}
@media(max-width:520px){
  .value-board{inset:17% 8% 21%}
  .value-groups section{height:92%}
  .value-active #game .heading{inset:auto 22% 5%}
}

/* Toolbar A: warm enamel, engraved gold edges, and cream labels. */
.topbar .tools{gap:clamp(4px,.68vw,10px)}
.topbar .tools :is(#number-picker,#language-toggle,#sound,#full){
  box-sizing:border-box;height:clamp(32px,3.25vw,46px);min-height:0;
  border:3px double #e9ac50;border-radius:12px;color:#fff1be;
  background:radial-gradient(circle at 7% 16%,#f8c562 0 1px,transparent 2px),
    radial-gradient(circle at 93% 16%,#f8c562 0 1px,transparent 2px),
    radial-gradient(circle at 7% 84%,#f8c562 0 1px,transparent 2px),
    radial-gradient(circle at 93% 84%,#f8c562 0 1px,transparent 2px),
    linear-gradient(160deg,#79301d,#4d181a 60%,#3b1116);
  box-shadow:0 2px 0 #5a291a,inset 0 0 0 1px #bf783949;
  font-weight:800
}
.topbar .tools :is(#number-picker,#full){padding-inline:clamp(6px,.75vw,13px)}
.topbar .tools :is(#language-toggle,#sound){width:clamp(34px,3.25vw,46px);padding:0}
.topbar .tools :is(#number-picker,#language-toggle,#sound,#full):hover{filter:brightness(1.17)}
.topbar .tools :is(#number-picker,#language-toggle,#sound,#full):focus-visible{outline:2px solid #fff0ad;outline-offset:2px}
.topbar .tools #language{background:#542126;color:#fff1be;border-color:#db9f4b}
.toolbar-globe{position:relative;display:block;width:1.15rem;aspect-ratio:1;border:1.5px solid #ffe1a0;border-radius:50%}
.toolbar-globe::before{content:"";position:absolute;inset:-1px 23%;border:1px solid #ffe1a0;border-radius:50%}
.toolbar-globe::after{content:"";position:absolute;inset:0;background:linear-gradient(transparent 31%,#ffe1a0 33% 39%,transparent 41% 60%,#ffe1a0 62% 68%,transparent 70%)}
@media(min-width:650px){.topbar #full-label{display:inline}}

/* Reserve space for the whole range and a separate dropdown chevron. */
.topbar .tools #number-picker{
  appearance:none;min-width:106px;max-width:none;width:auto;
  padding-inline:12px 31px;font-variant-numeric:tabular-nums;white-space:nowrap;
  background:
    linear-gradient(45deg,transparent 48%,#ffe4a7 49% 65%,transparent 66%) right 17px center/6px 6px no-repeat,
    linear-gradient(135deg,transparent 38%,#ffe4a7 39% 55%,transparent 56%) right 12px center/6px 6px no-repeat,
    linear-gradient(160deg,#79301d,#4d181a 60%,#3b1116)
}
.topbar .tools #number-picker option{background:#542126;color:#fff1be}
.topbar .tools #full:not([hidden]){display:flex;align-items:center;justify-content:center;gap:.38em}
.topbar .tools #full > span:first-child{font-size:1.15em;line-height:1;flex:none}
@media(max-width:470px){
  .topbar .tools #number-picker{min-width:82px;padding-inline:7px 22px;background-position:right 12px center,right 7px center,center}
  .cover-active .topbar #full-label{display:none}
}

/* Language chooser A: a searchable parchment panel. */
.language-popover{
  position:absolute;z-index:20;right:0;top:calc(100% + 10px);
  width:clamp(178px,20vw,288px);padding:9px;border:4px double #c98d32;border-radius:18px 18px 22px 22px;
  background:radial-gradient(ellipse at center,#fff4d9,#f2d394);color:#612636;
  box-shadow:0 5px 16px #251023a8,inset 0 0 0 2px #ffebbb;box-sizing:border-box
}
.language-popover::before{
  content:"";position:absolute;right:14px;top:-11px;width:14px;height:14px;transform:rotate(45deg);
  background:#f2d394;border-left:2px solid #c98d32;border-top:2px solid #c98d32
}
.language-search-wrap{position:relative;margin-bottom:6px}
.language-magnifier{position:absolute;top:50%;left:9px;width:10px;height:10px;border:1.5px solid #78363f;border-radius:50%;transform:translateY(-62%);pointer-events:none}
.language-magnifier::after{content:"";position:absolute;left:8px;top:8px;width:5px;height:1.5px;background:#78363f;transform:rotate(45deg)}
.language-popover #language-search{
  display:block;width:100%;padding:7px 8px 7px 26px;border:1px solid #bb8c56;border-radius:13px;
  background:#fff7dc;color:#5e2333;font-family:inherit;font-weight:700;font-size:clamp(.75rem,1.14vw,1.05rem);line-height:1.2;
}
.language-options{max-height:min(54dvh,330px);overflow:auto;overscroll-behavior:contain;scrollbar-color:#c58c43 #f6dcab;padding-inline-end:3px}
.topbar .language-popover .language-option{
  display:flex;align-items:center;justify-content:space-between;gap:5px;text-align:start;width:100%;
  height:auto;min-height:32px;margin:0;padding:5px 8px;border:0;border-radius:8px;
  color:#612536;background:transparent;box-shadow:none;font-size:clamp(.78rem,1.2vw,1.13rem);font-weight:760;
}
.topbar .language-popover .language-option:hover,.topbar .language-popover .language-option:focus-visible{background:#f5d891;outline-offset:-2px}
.topbar .language-popover .language-option[aria-pressed=true]{background:#f7c75c;color:#4e152e}
.language-option[aria-pressed=true]::after{content:"✓";flex:none;color:#582238}
.language-empty{margin:.4em;text-align:center}
@media(max-width:470px){.language-popover{right:-5px;width:min(205px,78vw);padding:6px}}





/* Enamel signs for activity instructions and feedback. */
body:has(#art-frame){
  --sign-fill:linear-gradient(#70284e,#461632 72%,#34132e);
  --sign-edge:#edb854;
  --sign-ink:#fff3cb;
  --sign-shadow:inset 0 0 0 2px #ffd27b35,0 3px 7px #23102580;
}
#art-words .art-label:is(.art-prompt,.art-title,.art-sweets,.art-toys),
.gate-active #art-words .gate-copy,
body:is(.count-active,.value-active) #art-frame #game .heading{
  background:var(--sign-fill);
  border:1px solid var(--sign-edge);
  border-radius:clamp(8px,1cqw,17px);
  box-shadow:var(--sign-shadow);
  color:var(--sign-ink);
  text-shadow:none;
}
#art-words .art-label:is(.art-prompt,.art-title,.art-sweets,.art-toys){padding:.12em .55em}
.cart-active #art-words .art-prompt{
  inset:11% 25% auto;
  height:9%;
  font-size:clamp(.62rem,3.1cqw,3.2rem);
}
.wheel-active #art-words .art-title{
  inset:2.8% 39% auto;height:6.3%;
  font-size:clamp(.68rem,2.1cqw,2.35rem);
}
.wheel-active #art-words .art-prompt{
  inset:13.5% 39% auto;height:5.6%;
  font-size:clamp(.55rem,1.55cqw,1.75rem);
}
.wheel-active #art-words .art-label:is(.art-sweets,.art-toys){
  height:6%;
  padding:0 .28em;
  border:0;
  background:none;
  box-shadow:none;
  color:#fff3cb;
  text-shadow:0 .08em .12em #510b2e;
  font-size:clamp(.55rem,1.65cqw,1.85rem);
}
.wheel-active #art-words .art-sweets{inset:38.3% 85% auto 3.6%}
.wheel-active #art-words .art-toys{inset:36.4% 1.9% auto 87.5%}
@media (min-aspect-ratio:19/10){
  .wheel-active #art-words .art-sweets{inset:36% 77.3% auto 13.7%}
  .wheel-active #art-words .art-toys{inset:34.5% 9% auto 79.6%}
}
.wheel-solved #art-words :is(.art-sweets,.art-toys){display:none}
.gate-active #art-words .gate-copy{
  position:absolute;inset:11% 38% auto;min-height:5.8%;
  display:grid;place-items:center;text-align:center;
  padding:.32cqw .75cqw;
}
.gate-copy > span{
  display:block;width:100%;white-space:nowrap;line-height:1.15;
  font-family:"Nirmala UI","Segoe UI",sans-serif;
}
.gate-copy-primary{font-weight:850;font-size:clamp(.57rem,1.68cqw,1.85rem)}
.gate-copy > .gate-copy-secondary{display:none}
body:is(.count-active,.value-active) #art-frame #game .heading #message{
  color:var(--sign-ink);
  overflow-wrap:anywhere;
}
@media (orientation:portrait) and (max-width:740px){
  body:is(.gate-active,.cart-active,.puppet-active,.rail-active,.wheel-active) #art-frame #game .heading:has(#message){
    background:var(--sign-fill);
    border-color:var(--sign-edge);
    box-shadow:var(--sign-shadow);
    text-wrap:balance;
    overflow-wrap:anywhere;
  }
}
