/* Thankful Barn Raising. System fonts only, no inline styles in the markup.
   One "stage" per orientation (landscape 640 tall, portrait 640 wide) that game.js scales to fit the screen,
   so nothing ever scrolls or spills off the edge. */
[hidden]{display:none!important}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%;width:100%;overflow:hidden;overscroll-behavior:none;touch-action:none;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
body{position:fixed;inset:0;height:100dvh;background:#9fd3f2;color:#4a2b17;
  font-family:ui-rounded,"SF Pro Rounded","Nunito","Segoe UI Rounded","Trebuchet MS",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
#tb{position:fixed;inset:0;height:100dvh;width:100vw;overflow:hidden;overscroll-behavior:none;touch-action:none}
.bg{position:absolute;inset:0;background:url(assets/bg-wide.jpg) center bottom/cover no-repeat}
.is-port .bg{background-image:url(assets/bg-tall.jpg);background-position:center top}
.title-art{position:absolute;inset:0;background:url(assets/title-wide.jpg) right center/cover no-repeat;display:none}
.is-port .title-art{background-image:url(assets/title-tall.jpg);background-position:center top}
.scr-title .title-art{display:block}
.safe{position:absolute;visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
#fx{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:60}
button,a{touch-action:manipulation;font:inherit;color:inherit}
button{cursor:pointer;-webkit-appearance:none;appearance:none}
button:disabled{cursor:default}
svg{display:block}
.nojs{position:absolute;inset:40% 10% auto;text-align:center;font-weight:800;background:#fff;padding:16px;border-radius:16px}
:focus-visible{outline:5px solid #2f6fd6;outline-offset:3px}

/* drifting clouds over the painted sky */
.clouds{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.cl{position:absolute;width:260px;height:80px;border-radius:50%;opacity:.55;filter:blur(2px);
  background:radial-gradient(ellipse 40% 60% at 30% 60%,#fff 60%,transparent 62%),radial-gradient(ellipse 35% 70% at 58% 45%,#fff 60%,transparent 62%),radial-gradient(ellipse 30% 50% at 80% 65%,#fff 60%,transparent 62%);
  animation:drift 90s linear infinite}
.cl.c1{top:8%;left:-280px}.cl.c2{top:20%;left:-280px;animation-duration:130s;animation-delay:-60s;transform:scale(.7)}.cl.c3{top:4%;left:-280px;animation-duration:110s;animation-delay:-30s;transform:scale(.5)}
@keyframes drift{to{left:110%}}
.scr-title .clouds{opacity:.6}

.stage{position:absolute;left:0;top:0;width:1000px;height:640px;transform-origin:0 0}

/* ---------- buttons ---------- */
.hbtn{flex:0 0 auto;width:68px;height:68px;border-radius:22px;border:0;display:grid;place-items:center;padding:0;text-decoration:none;
  background:linear-gradient(#fffdf6,#ffefcf);box-shadow:0 4px 0 #c99456,0 8px 16px #5a3a1430,inset 0 2px 0 #fff;color:#a0461f}
.hbtn svg{width:38px;height:38px}
.hbtn.big svg{width:46px;height:46px}
.hbtn:active,.tbtn:active,.go:active,.wcard:active,.cbtn:active,.qbtn:active,.pzcard:active,.pz-ch:active,.pile:active,.cl-item:active{transform:translateY(3px)}
.hbtn.kav-off,.hbtn.off{color:#bba48e}
.go{border:0;border-radius:40px;padding:0 34px;height:80px;font-weight:900;font-size:31px;color:#fff;letter-spacing:.3px;
  background:linear-gradient(#ff7a5c,#d8382a);box-shadow:0 6px 0 #9b2117,0 12px 24px #7a1a1055,inset 0 3px 0 #ffb9a6;text-shadow:0 2px 0 #9b2117}
.go:disabled{background:linear-gradient(#e9ddd0,#cdbca9);box-shadow:0 6px 0 #a8957f;text-shadow:none;color:#fffaf2}
.go.small{height:66px;font-size:26px;padding:0 24px}
.tbtn{border:0;border-radius:34px;padding:0 24px;height:66px;font-weight:900;font-size:24px;color:#7a3c16;
  background:linear-gradient(#fffdf6,#ffecc8);box-shadow:0 5px 0 #c99456,0 10px 18px #5a3a1430}
.tbtn.small{height:66px;font-size:21px;padding:0 18px;border-radius:28px}

/* ---------- title ---------- */
.title-card{position:absolute;inset:0;z-index:5}
.title-box{position:absolute;left:36px;top:50%;transform:translateY(-50%);width:450px;padding:28px 30px 22px;border-radius:40px;
  background:linear-gradient(#fffdf6f2,#fff2d8f2);box-shadow:0 8px 0 #d4a265,0 20px 40px #5a3a1440;text-align:center}
.port .title-box{left:36px;right:36px;width:auto;top:auto;bottom:34px;transform:none}
.title-box h1{margin:0;line-height:.95;font-weight:900;font-size:64px;letter-spacing:-.5px}
.title-box h1 .t1{display:block;color:#e0493c;text-shadow:0 3px 0 #fff,0 6px 0 #9b2117}
.title-box h1 .t2{display:block;color:#3f8f2f;font-size:50px;text-shadow:0 3px 0 #fff,0 6px 0 #22601a}
.lead{margin:16px 0 18px;font-size:23px;font-weight:800;line-height:1.3;color:#6b3f1d}
.title-row{display:flex;gap:14px;justify-content:center;align-items:center}
.little{display:flex;align-items:center;gap:12px;height:66px;margin:16px auto 0;padding:0 18px 0 10px;border:0;border-radius:34px;background:linear-gradient(#f3fff0,#d8f3cf);box-shadow:0 4px 0 #8cc77d;text-align:left}
.little .sw{width:62px;height:36px;border-radius:18px;background:#c9d7c4;position:relative;transition:background .2s;flex:0 0 auto}
.little .knob{position:absolute;left:4px;top:4px;width:28px;height:28px;border-radius:50%;background:#fff;box-shadow:0 2px 4px #0003;transition:transform .2s}
.little.on .sw{background:#4aa63a}.little.on .knob{transform:translateX(26px)}
.little-t b{display:block;font-size:23px;color:#2c6d22}.little-t small{display:block;font-size:16px;font-weight:700;color:#4c7d43}
.title-note{margin:14px 0 0;font-size:16px;font-weight:700;color:#8a6a4c}
.title-note a{color:#a0461f}

/* ---------- play: HUD ---------- */
.play{position:absolute;inset:0}
.hud{position:absolute;left:0;right:0;top:0;height:84px;display:flex;align-items:center;gap:10px;padding:8px 14px;z-index:20}
.hud-gap{flex:1 1 auto}
.stars{flex:0 0 auto;height:60px;min-width:86px;display:flex;align-items:center;gap:6px;padding:0 14px 0 10px;border-radius:30px;background:#fffdf6f0;box-shadow:0 4px 0 #c99456;font-weight:900;font-size:28px;color:#8a5a12}
.star-ic{width:36px;height:36px;display:block;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M16 2.5l4 8.6 9.4 1.1-7 6.4 1.9 9.3L16 23.2l-8.3 4.7 1.9-9.3-7-6.4 9.4-1.1z' fill='%23ffc928' stroke='%23c98a00' stroke-width='2' stroke-linejoin='round'/><path d='M11 11.5l3-.4' stroke='%23fff6c8' stroke-width='2' stroke-linecap='round'/></svg>") center/contain no-repeat}

/* ---------- scene ---------- */
.scene{position:absolute;left:0;top:0;overflow:visible}
.signs{position:absolute;left:14px;right:14px;top:94px;display:flex;align-items:center;gap:12px;z-index:6}
.switch{display:flex;padding:5px;gap:4px;border-radius:30px;background:#7a4c22;box-shadow:0 4px 0 #4f2f12,0 8px 14px #3a200a40}
.sw-b{border:0;min-height:66px;height:auto;padding:8px 14px;border-radius:26px;font-weight:900;font-size:19px;color:#ffe9c9;background:transparent;white-space:nowrap;line-height:1.05}
.sw-b small{display:block;font-size:13px;font-weight:800;opacity:.85}
.sw-b.on{background:linear-gradient(#fffdf6,#ffe7bd);color:#7a3c16;box-shadow:0 3px 0 #c99456}
.count-board{margin-left:auto;display:grid;grid-template-columns:auto auto auto;grid-template-rows:auto auto;column-gap:8px;align-items:center;min-height:62px;height:auto;padding:4px 6px 4px 12px;border-radius:18px;
  background:linear-gradient(#c58a50,#a46b36);box-shadow:inset 0 2px 0 #e7b27a,0 4px 0 #6d4420,0 8px 14px #3a200a40;color:#fff8ea}
.cb-n{grid-row:1/3;font-size:36px;font-weight:900;text-shadow:0 2px 0 #6d4420;line-height:1}
.cb-t{grid-column:2;grid-row:1;align-self:end;font-size:18px;font-weight:800;line-height:1.05}
.cb-pv{grid-column:2;grid-row:2;align-self:start;font-size:14px;font-weight:800;color:#ffe2b0;white-space:nowrap;line-height:1.1}
.cb-go{grid-column:3;grid-row:1/3;border:0;height:66px;padding:0 14px;border-radius:14px;font-weight:900;font-size:19px;color:#7a3c16;background:linear-gradient(#fffdf6,#ffe7bd);box-shadow:0 3px 0 #6d4420}
.port .signs{top:92px}
.pretend{position:absolute;left:18px;right:18px;top:600px;margin:0;text-align:center;font-size:16px;font-weight:800;color:#5b3a1a;z-index:6;pointer-events:none}
.pretend::before{content:"";display:inline-block;width:22px;height:22px;margin:-4px 6px 0 0;vertical-align:middle;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='%23fff3d0' stroke='%23c98a00' stroke-width='2'/><path d='M12 7v6M12 16.5v.5' stroke='%23a0461f' stroke-width='2.6' stroke-linecap='round'/></svg>") center/contain no-repeat}
.pretend{background:#fff8e6e8;border-radius:16px;padding:5px 10px;box-shadow:0 3px 0 #d4a265;left:50%;right:auto;transform:translate(-50%,-100%);width:max-content;max-width:calc(100% - 30px);font-size:15px;padding:4px 12px;background:#fff8e6f2}

.barnwrap{position:absolute;inset:0;z-index:2;pointer-events:none}
.barnwrap.hot .barn{filter:drop-shadow(0 0 14px #fff6a0)}
.barn{position:absolute;left:0;top:0;width:0;height:0;pointer-events:auto}
.barn>*{position:absolute}
.b-base svg,.b-roof svg,.b-bunt svg{width:100%;height:100%;display:block}
.b-base{filter:drop-shadow(0 6px 6px #3a200a40)}
.b-roof{filter:drop-shadow(0 -2px 3px #3a200a30)}
.b-wall{border-radius:3px;background:linear-gradient(90deg,#fff3e0 0,#fff3e0 3.6%,#a8291f 3.6%,#c63d31 12%,#c63d31 88%,#a8291f 96.4%,#fff3e0 96.4%);box-shadow:0 0 0 2px #fff3e055 inset}
.b-band{border-radius:4px;display:grid;place-items:center;
  background:repeating-linear-gradient(90deg,#e0493c 0 10%,#f7c935 10% 20%,#3d9be3 20% 30%,#5cb84b 30% 40%,#f27aaa 40% 50%,#8f5fd8 50% 60%,#f39130 60% 70%,#b67c47 70% 80%,#e0493c 80% 90%,#3d9be3 90% 100%);
  box-shadow:inset 0 -4px 0 #0003,inset 0 3px 0 #fff5}
.bb-l{font-weight:900;color:#fff;text-shadow:0 2px 0 #0007;white-space:nowrap}
.b-bunt{pointer-events:none;z-index:3}
.b-loft{border-radius:3px 3px 0 0;background:linear-gradient(90deg,#fff3e0 0,#fff3e0 3.6%,#a8291f 3.6%,#c63d31 12%,#c63d31 88%,#a8291f 96.4%,#fff3e0 96.4%);box-shadow:inset 0 -4px 0 #fff3e0}

/* ---------- blocks ---------- */
.blk{position:relative;display:block;border-radius:16%;
  background:linear-gradient(160deg,var(--l) 0%,var(--a) 34%,var(--a) 64%,var(--b) 100%);
  box-shadow:inset 0 2px 0 #ffffff70,inset 0 -3px 0 #00000030,0 2px 2px #3a200a40}
.blk::before{content:"";position:absolute;inset:0;border-radius:inherit;opacity:.22;
  background:repeating-linear-gradient(176deg,transparent 0 7px,#5a2e0c 7px 8px,transparent 8px 15px),radial-gradient(ellipse 60% 22% at 30% 16%,#fff 0,transparent 70%)}
.blk.tiny{border-radius:2px;box-shadow:inset 0 1px 0 #ffffff60,inset 0 -1px 0 #00000030}
.blk.tiny::before{display:none}
.blk .pic{position:absolute;inset:13%;border-radius:20%;background-color:#fffaf0e8;background-size:84% auto;box-shadow:inset 0 1px 2px #0003}
.pic{display:block;background-position:center;background-repeat:no-repeat;background-size:contain}
.c-red{--a:#e0493c;--b:#a8261f;--l:#ff8f7c}.c-orange{--a:#f39130;--b:#b85c10;--l:#ffc27a}.c-yellow{--a:#f7c935;--b:#b98a0c;--l:#fff0a0}
.c-green{--a:#5cb84b;--b:#2e7a26;--l:#a8e59a}.c-blue{--a:#3d9be3;--b:#1d5f9e;--l:#9fd2fb}.c-purple{--a:#8f5fd8;--b:#5a2fa0;--l:#c9adf5}
.c-pink{--a:#f27aaa;--b:#b8406f;--l:#ffc2da}.c-brown{--a:#b67c47;--b:#7a4c22;--l:#e0b58a}
.w-thanks{background-image:url(assets/w-thanks.png)}.w-kind{background-image:url(assets/w-kind.png)}.w-helper{background-image:url(assets/w-helper.png)}
.w-family{background-image:url(assets/w-family.png)}.w-friends{background-image:url(assets/w-friends.png)}.w-sunshine{background-image:url(assets/w-sunshine.png)}
.w-love{background-image:url(assets/w-love.png)}.w-hug{background-image:url(assets/w-hug.png)}.w-share{background-image:url(assets/w-share.png)}
.w-smile{background-image:url(assets/w-smile.png)}.w-brave{background-image:url(assets/w-brave.png)}.w-hope{background-image:url(assets/w-hope.png)}
.w-caring{background-image:url(assets/w-caring.png)}.w-joy{background-image:url(assets/w-joy.png)}.w-cozy{background-image:url(assets/w-cozy.png)}.w-calm{background-image:url(assets/w-calm.png)}
#barn .blk{position:absolute;cursor:pointer}
.blk.ping{animation:ping .5s ease}
@keyframes ping{40%{transform:translateY(-14%) scale(1.12)}}
.blk.pop{animation:pop .35s cubic-bezier(.3,1.6,.6,1)}
@keyframes pop{from{transform:scale(.3)}}
.ghost{border-radius:16%;border:2px dashed #fff3e0aa;background:#ffffff1c}
.ghost.next{border-color:#fff6a0;background:#fff6a033;animation:next 1.3s ease-in-out infinite}
@keyframes next{50%{background:#fff6a066;transform:scale(.92)}}
.ghost.glow{border-color:#ffe066;background:#ffe06655;animation:next .9s ease-in-out infinite}
.ftag{display:grid;place-items:center;border-radius:999px;font-weight:900;color:#5b3a1a;background:#fffaf0;box-shadow:0 2px 0 #c99456;line-height:1}
.ftag.dim{opacity:0}
.ftag.lit{animation:lit .7s ease;opacity:1}
@keyframes lit{0%{transform:scale(1)}35%{transform:scale(1.5);background:#ffd23f;color:#7a3c16}100%{transform:scale(1)}}
.deco{background-position:center bottom;background-repeat:no-repeat;background-size:contain;pointer-events:none}
.d-vane{background-image:url(assets/dec-vane.png);transform-origin:50% 90%;animation:vane 6s ease-in-out infinite}
@keyframes vane{50%{transform:rotate(3deg)}}
.d-flowerbox{background-image:url(assets/dec-flowerbox.png);z-index:4}
.d-sunflowers{background-image:url(assets/dec-sunflowers.png);transform-origin:50% 100%;animation:sway 5s ease-in-out infinite}
@keyframes sway{50%{transform:rotate(2.5deg)}}
.d-hay{background-image:url(assets/dec-hay.png)}
.d-pumpkins{background-image:url(assets/dec-pumpkins.png)}
.d-lantern{background-image:url(assets/dec-lantern.png);transform-origin:50% 0;animation:swing 3.5s ease-in-out infinite;filter:drop-shadow(0 0 8px #ffd77a)}
@keyframes swing{50%{transform:rotate(4deg)}}

/* ---------- farm friends ---------- */
.friends{position:absolute;left:0;top:0;pointer-events:none;z-index:3}
.yard{position:absolute;pointer-events:none;background:url(assets/yard.png) center top/100% 100% no-repeat}
.ground-deco{position:absolute;inset:0;pointer-events:none}
.ground-deco>*{position:absolute}
.friend{position:absolute;border:0;padding:0;background:none;pointer-events:auto;z-index:4}
.friend .f-in{position:absolute;inset:0;display:block;transform-origin:50% 100%;animation:breathe 3.2s ease-in-out infinite}
.f-sheep .f-in{animation-delay:-.7s}.f-pig .f-in{animation-delay:-1.4s}.f-goat .f-in{animation-delay:-2s}
@keyframes breathe{50%{transform:scale(1.015,1.035)}}
.f-img{position:absolute;inset:0;background-position:center bottom;background-repeat:no-repeat;background-size:contain;filter:drop-shadow(0 5px 4px #3a200a40)}
.f-cow .f-img{background-image:url(assets/cow.png)}.f-pig .f-img{background-image:url(assets/pig.png)}.f-sheep .f-img{background-image:url(assets/sheep.png)}
.f-goat .f-img{background-image:url(assets/goat.png)}.f-hen .f-img{background-image:url(assets/hen.png)}
.friend.cheer .f-in{animation:hop .9s cubic-bezier(.3,.7,.4,1)}
@keyframes hop{0%{transform:none}15%{transform:scale(1.1,.86)}45%{transform:translateY(-26%) scale(.94,1.08) rotate(-4deg)}70%{transform:scale(1.06,.92)}100%{transform:none}}
.f-hen{z-index:5}
.f-hen .f-in{animation:peck 1.1s ease-in-out infinite}
@keyframes peck{0%,100%{transform:none}25%{transform:translateY(-4%) rotate(-3deg)}50%{transform:none}75%{transform:translateY(-4%) rotate(3deg)}}
.helper{z-index:5}
.helper .f-in{animation:breathe 3s ease-in-out infinite}
.helper.talk .f-in{animation:talk .8s ease}
@keyframes talk{30%{transform:rotate(-3deg) translateY(-3%)}60%{transform:rotate(2deg)}}
.h-body{position:absolute;left:0;bottom:0;width:100%;height:auto;filter:drop-shadow(0 5px 4px #3a200a40);pointer-events:none}
.h-hat{position:absolute;left:19%;width:58%;top:-12%;height:auto;pointer-events:none;filter:drop-shadow(0 3px 2px #3a200a40)}
.h-hat.hat-straw{left:20.0%;width:55.9%;top:-17.8%}.h-hat.hat-cap{left:25.9%;width:44.1%;top:-23.5%}.h-hat.hat-flowers{left:25.9%;width:44.1%;top:-11.8%}
.h-hat.hat-cowboy{left:20.0%;width:55.9%;top:-20.9%}.h-hat.hat-beanie{left:27.4%;width:41.2%;top:-25.2%}.h-hat.hat-rain{left:22.2%;width:51.5%;top:-20.3%}

.tip{position:absolute;z-index:12;display:flex;align-items:center;gap:8px;width:168px;padding:8px 12px;border-radius:20px;background:#fffdf6;box-shadow:0 4px 0 #d4a265,0 10px 18px #3a200a40;pointer-events:none;animation:pop .3s cubic-bezier(.3,1.6,.6,1)}
.tip::after{content:"";position:absolute;left:50%;bottom:-12px;margin-left:-12px;border:12px solid transparent;border-bottom:0;border-top-color:#fffdf6}
.tip-pic{width:46px;height:46px;flex:0 0 auto}
.tip b{font-size:22px;font-weight:900;color:#7a3c16}

/* ---------- speech bubble ---------- */
.bubble{position:absolute;left:18px;top:176px;max-width:560px;z-index:15;pointer-events:none;opacity:0;transform:translateY(-6px);transition:opacity .3s,transform .3s}
.bubble.on{opacity:1;transform:none}
.bubble p{margin:0;padding:10px 18px;border-radius:22px;background:#fffdf6f4;box-shadow:0 4px 0 #d4a265,0 10px 18px #3a200a30;font-size:21px;font-weight:800;line-height:1.25;color:#5b3a1a}


/* ---------- the build panel ---------- */
.panel{position:absolute;z-index:8;display:flex;flex-direction:column;border-radius:30px;padding:12px 14px 14px;
  background:linear-gradient(#fffdf6,#fff1d6);border:5px solid #c58a50;box-shadow:inset 0 0 0 3px #fff8ea,0 7px 0 #8a5527,0 16px 30px #3a200a45}
.p-head{display:flex;align-items:center;gap:10px;height:52px;flex:0 0 auto}
.p-step{flex:0 0 auto;width:48px;height:48px;border-radius:50%;display:grid;place-items:center;font-weight:900;font-size:26px;color:#fff;background:radial-gradient(circle at 35% 30%,#ff8f7c,#c63d31);box-shadow:inset 0 -4px 0 #8f2219}
.p-head h2{margin:0;font-size:29px;font-weight:900;color:#a0461f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.p-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:10px;padding-top:8px}
.wgrid{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:8px}
.wgrid.n6{grid-template-columns:repeat(3,minmax(0,1fr))}
.wcard{border:0;border-radius:20px;padding:6px 4px;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  background:linear-gradient(#ffffff,#fff4de);box-shadow:0 4px 0 #dcb382,0 7px 12px #5a3a1420}
.wcard .pic{flex:1 1 auto;width:100%;min-height:0}
.wl{flex:0 0 auto;font-size:19px;font-weight:900;color:#6b3a16;line-height:1.05;white-space:nowrap}
.n6 .wl{font-size:26px}
.c-top{display:flex;align-items:center;gap:12px;flex:0 0 auto}
.c-word{display:flex;align-items:center;gap:8px;font-size:28px;font-weight:900;color:#6b3a16}
.c-word .pic{width:52px;height:52px}
.cgrid{flex:0 0 auto;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.cgrid.n6{grid-template-columns:repeat(3,minmax(0,1fr));flex:1 1 auto;grid-auto-rows:minmax(0,1fr)}
.cbtn{border:0;padding:6px;border-radius:20px;background:#fff8ea;box-shadow:0 4px 0 #dcb382;display:grid;place-items:center;aspect-ratio:1/1;min-height:0}
.cgrid.n6 .cbtn{aspect-ratio:auto}
.cbtn .blk{width:100%;height:100%;max-width:110px;max-height:110px;aspect-ratio:1/1}
.cbtn.on{background:#fff2a8;box-shadow:0 4px 0 #e0a800,0 0 0 4px #ffd23f}
.dropzone{flex:1 1 auto;min-height:0;display:flex;align-items:center;gap:16px;padding:6px 4px}
.preview{flex:0 0 auto;width:128px;height:128px;border-radius:24px;display:grid;place-items:center;background:repeating-linear-gradient(45deg,#fff3d6 0 10px,#ffe9c0 10px 20px);box-shadow:inset 0 3px 6px #5a3a1430}
.preview .blk{width:112px;height:112px;cursor:grab;touch-action:none;animation:bob 1.6s ease-in-out infinite}
.preview .blk.lifted{opacity:.35;animation:none}
@keyframes bob{50%{transform:translateY(-6px) rotate(-2deg)}}
.pv-q{font-size:60px;font-weight:900;color:#d9b27a}
.dz-side{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:8px;align-items:flex-start}
.dz-hint{margin:0;font-size:18px;font-weight:800;color:#8a5a2a;line-height:1.25}
.blk.dragging{position:absolute;z-index:70;pointer-events:none;transform:rotate(-6deg) scale(1.08);filter:drop-shadow(0 14px 14px #3a200a60)}
.landing{flex:1 1 auto;display:grid;place-items:center}
.landing .blk{width:120px;height:120px;animation:fly .7s ease-in forwards}
@keyframes fly{to{transform:translateY(-220px) scale(.4);opacity:0}}
/* question */
.q-t{margin:6px 0 0;font-size:30px;font-weight:900;line-height:1.15;color:#6b3a16}
.q-sub{margin:0;font-size:21px;font-weight:800;color:#8a5a2a}
.q-row{flex:1 1 auto;display:flex;align-items:center;justify-content:center;gap:18px;min-height:0}
.qbtn{border:0;width:118px;height:118px;border-radius:50%;font-size:50px;font-weight:900;color:#6b3a16;background:radial-gradient(circle at 40% 30%,#fff,#ffe9c0);box-shadow:0 6px 0 #c99456,0 12px 18px #5a3a1430}
.qbtn.right{background:radial-gradient(circle at 40% 30%,#e6ffd9,#8ad46f);color:#1f5a14;box-shadow:0 6px 0 #3f8f2f;animation:pop .4s cubic-bezier(.3,1.6,.6,1)}
.qbtn.wrong{opacity:.35;animation:shake .4s}
@keyframes shake{25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}
.q-skip{align-self:flex-end}
/* waiting */
.wclock{display:flex;align-items:center;gap:16px;flex:0 0 auto}
.dial{--p:0;position:relative;flex:0 0 auto;width:104px;height:104px;border-radius:50%;background:conic-gradient(#ffc928 calc(var(--p)*360deg),#efe0c2 0);box-shadow:inset 0 0 0 8px #fff8ea,0 4px 0 #dcb382}
.dial .sun{position:absolute;inset:26px;border-radius:50%;background:radial-gradient(circle at 40% 35%,#fff6b0,#ffc928 60%,#f39130);box-shadow:0 0 16px #ffd23f;animation:glow 2.4s ease-in-out infinite}
@keyframes glow{50%{box-shadow:0 0 28px #ffd23f}}
.dial .hand{position:absolute;left:50%;top:10px;width:6px;height:42px;margin-left:-3px;border-radius:3px;background:#a0461f;transform-origin:50% 42px;transform:rotate(calc(var(--p)*360deg))}
.wtext{display:flex;flex-direction:column}
.wmin{font-size:52px;font-weight:900;color:#c63d31;line-height:1}
.wlab{font-size:20px;font-weight:800;color:#6b3a16;line-height:1.2}
.wbtns{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:1fr 1fr;gap:12px}
.pzcard{border:0;border-radius:24px;padding:10px;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;background:linear-gradient(#ffffff,#fff1d4);box-shadow:0 5px 0 #dcb382,0 9px 14px #5a3a1425}
.pz-art{flex:1 1 auto;width:100%;min-height:0;display:grid;place-items:center}
.pz-art svg{width:100%;max-width:170px;height:100%;max-height:90px}
.pzcard b{font-size:24px;font-weight:900;color:#a0461f}
.pzcard small{font-size:17px;font-weight:800;color:#8a5a2a}
.w-note{margin:0;font-size:16px;font-weight:700;color:#8a6a4c;line-height:1.25}

/* ---------- place value card ---------- */
.pvcard{position:absolute;left:50%;top:44%;z-index:14;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 20px;border-radius:26px;
  background:#fffdf6f6;box-shadow:0 6px 0 #d4a265,0 16px 28px #3a200a45;animation:pvin .45s cubic-bezier(.3,1.5,.6,1)}
.pvcard.out{opacity:0;transition:opacity .45s}
@keyframes pvin{from{transform:translate(-50%,-50%) scale(.5);opacity:0}}
.pv-n{font-size:48px;font-weight:900;color:#c63d31;line-height:1}
.pv-cols{display:flex;gap:14px;align-items:flex-end}
.pv-col{display:flex;flex-direction:column;align-items:center;gap:3px;min-width:74px}
.pv-g{display:flex;flex-wrap:wrap;gap:3px;justify-content:center;max-width:110px;min-height:30px;align-items:flex-end}
.pv-col.h .pv-i{width:30px;height:30px;border-radius:5px;background:repeating-linear-gradient(90deg,#e0493c 0 3px,#c63d31 3px 6px),#e0493c;box-shadow:inset 0 0 0 2px #8f2219}
.pv-col.t .pv-i{width:9px;height:44px;border-radius:3px;background:repeating-linear-gradient(#3d9be3 0 3.6px,#1d5f9e 3.6px 4.4px);box-shadow:inset 0 0 0 1px #1d5f9e}
.pv-col.o .pv-i{width:11px;height:11px;border-radius:3px;background:#f7c935;box-shadow:inset 0 0 0 1px #b98a0c}
.pv-d{font-size:30px;font-weight:900;color:#6b3a16;line-height:1}
.pv-col small{font-size:17px;font-weight:800;color:#8a5a2a}

/* ---------- unlock toast ---------- */
.unlock{position:absolute;left:50%;top:110px;z-index:50;transform:translateX(-50%);display:flex;align-items:center;gap:12px;padding:10px 22px 10px 12px;border-radius:30px;background:linear-gradient(#fffbe0,#ffe9a0);box-shadow:0 5px 0 #d4a000,0 14px 24px #3a200a45;animation:pvin2 .5s cubic-bezier(.3,1.5,.6,1)}
@keyframes pvin2{from{transform:translateX(-50%) scale(.4);opacity:0}}
.unlock.out{opacity:0;transition:opacity .45s}
.unlock .cl-art{width:64px;height:64px}
.unlock b{font-size:25px;font-weight:900;color:#7a3c16;white-space:nowrap}

/* ---------- sheets (puzzles and closet) ---------- */
.sheet{position:absolute;inset:12px;z-index:30}
.sheet-in{position:absolute;inset:0;display:flex;flex-direction:column;border-radius:34px;padding:12px 18px 14px;
  background:linear-gradient(#fffdf6f8,#fff0d2f8);border:6px solid #c58a50;box-shadow:inset 0 0 0 3px #fff8ea,0 8px 0 #8a5527,0 20px 40px #3a200a50}
.sh-head{display:flex;align-items:center;gap:12px;flex:0 0 auto;height:76px}
.sh-head h2{flex:1 1 auto;margin:0;font-size:34px;font-weight:900;color:#a0461f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pz-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:12px;padding-top:6px}
.pz-switch{display:flex;gap:8px;justify-content:center;flex:0 0 auto}
.pz-tab{border:0;height:66px;padding:0 18px;border-radius:26px;font-weight:900;font-size:20px;color:#8a5a2a;background:#f6e4c4}
.pz-tab.on{background:linear-gradient(#ff8f7c,#d8382a);color:#fff;box-shadow:0 3px 0 #9b2117}
.fence{position:relative;flex:0 0 auto;padding:18px 10px;margin:0 auto;width:100%;max-width:980px}
.rail{position:absolute;left:0;right:0;height:16px;border-radius:8px;background:linear-gradient(#d9a066,#a66f3d);box-shadow:0 3px 0 #6d4420}
.rail.r1{top:34%}.rail.r2{top:72%}
.f-row{position:relative;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:10px}
.f-row.n6{grid-template-columns:repeat(6,minmax(0,1fr))}
.f-row .blk,.f-gap{width:100%;max-width:110px;aspect-ratio:1/1;justify-self:center;align-self:center;box-sizing:border-box}
.f-gap{display:grid;place-items:center;border-radius:16%;border:4px dashed #f0a830;background:#fff8e6;animation:next 1.3s ease-in-out infinite}
.f-gap b{font-size:44px;font-weight:900;color:#d17b00}
.f-gap.filled{border:0;background:none;animation:none}
.f-gap.ping{animation:ping .5s ease}
.pz-q{margin:0;text-align:center;font-size:30px;font-weight:900;color:#6b3a16}
.pz-choices{flex:1 1 auto;min-height:0;display:flex;justify-content:center;align-items:center;gap:24px}
.pz-ch{position:relative;border:0;width:136px;height:136px;padding:12px;border-radius:28px;background:#fff8ea;box-shadow:0 5px 0 #dcb382,0 10px 16px #5a3a1425;touch-action:none}
.pz-ch .blk{width:100%;height:100%}
.pz-ch .k{position:absolute;right:-6px;top:-8px;width:34px;height:34px;border-radius:50%;display:grid;place-items:center;font-size:19px;font-weight:900;color:#fff;background:#a0461f}
.pz-ch.right{background:#e6ffd9;box-shadow:0 5px 0 #3f8f2f,0 0 0 4px #8ad46f}
.pz-ch.wrong{opacity:.35;animation:shake .4s}
.little .pz-ch{width:170px;height:170px}
.pz-foot{flex:0 0 auto;display:flex;align-items:center;gap:12px}
.pz-stars{display:flex;align-items:center;gap:6px;font-size:28px;font-weight:900;color:#8a5a12;margin-right:auto}
/* stack & count */
.stk-goal{flex:0 0 auto;display:flex;align-items:center;justify-content:center;gap:14px}
.sg-n{width:78px;height:78px;border-radius:50%;display:grid;place-items:center;font-size:42px;font-weight:900;color:#fff;background:radial-gradient(circle at 35% 30%,#a8e59a,#3f8f2f);box-shadow:inset 0 -5px 0 #22601a}
.sg-t{font-size:30px;font-weight:900;color:#6b3a16}
.stk-mid{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:auto 1fr auto;grid-template-areas:"piles area side";gap:16px;align-items:center}
.port .stk-mid{grid-template-columns:1fr 1fr;grid-template-rows:1fr auto;grid-template-areas:"area area" "piles side"}
.piles{grid-area:piles;display:flex;flex-direction:column;gap:12px}
.port .piles{flex-direction:row;justify-content:center}
.pile{border:0;width:132px;height:132px;border-radius:26px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;background:linear-gradient(#ffffff,#fff1d4);box-shadow:0 5px 0 #dcb382,0 9px 14px #5a3a1425}
.pile b{font-size:28px;font-weight:900;color:#a0461f}
.pile.ping{animation:ping .5s}
.basket{position:relative;width:86px;height:58px;border-radius:8px 8px 28px 28px;background:repeating-linear-gradient(90deg,#c98f55 0 7px,#a66f3d 7px 9px);box-shadow:inset 0 -6px 0 #7a4c22;display:flex;justify-content:center;align-items:flex-start;gap:2px;padding-top:2px}
.basket .blk{width:24px;height:24px;margin-top:-12px}
.stick,.tstick{display:flex;flex-direction:column;gap:1px;padding:2px;border-radius:5px;background:#1d5f9e}
.stick{width:24px;height:76px}
.tcube{flex:1 1 0;border-radius:2px;background:linear-gradient(#9fd2fb,#3d9be3)}
.stk-area{grid-area:area;min-height:0;height:100%;display:flex;align-items:center;justify-content:center;gap:24px;padding:10px;border-radius:24px;background:#f8ead0;box-shadow:inset 0 4px 8px #5a3a1425}
.tframes{display:flex;gap:16px;flex-wrap:wrap;justify-content:center}
.port .tframes{flex-direction:column}
.tframe{display:grid;grid-template-columns:repeat(5,58px);grid-auto-rows:58px;gap:6px;padding:8px;border-radius:14px;background:#c58a50;box-shadow:inset 0 0 0 3px #a66f3d}
.tframe.five{grid-template-columns:repeat(5,96px);grid-auto-rows:96px;gap:10px}
.tslot{border-radius:10px;background:#fff8ea;box-shadow:inset 0 2px 4px #5a3a1440;display:grid;place-items:center}
.tslot.goal{background:#fff2a8}
.tslot .blk{width:92%;height:92%}
.tens-wrap{display:flex;gap:8px;align-items:flex-end;min-height:220px}
.tstick{width:30px;height:220px}
.tstick.pop{animation:pop .4s cubic-bezier(.3,1.6,.6,1)}
.ones-wrap{display:grid;grid-template-columns:repeat(3,40px);grid-auto-rows:40px;gap:6px;align-content:end;min-height:150px}
.ones-wrap .blk{width:40px;height:40px}
.stk-side{grid-area:side;display:flex;flex-direction:column;gap:10px;align-items:stretch;min-width:190px}
.port .stk-side{align-items:stretch}
.stk-read{display:flex;flex-direction:column;align-items:center;padding:6px 10px;border-radius:18px;background:#fff8ea;box-shadow:0 3px 0 #dcb382}
.stk-read b{font-size:46px;font-weight:900;color:#c63d31;line-height:1}
.stk-read small{font-size:18px;font-weight:800;color:#8a5a2a;text-align:center}
/* closet */
.cl-tabs{display:flex;gap:6px}
.cl-tab{border:0;height:66px;padding:0 18px;border-radius:27px;font-weight:900;font-size:21px;color:#8a5a2a;background:#f6e4c4}
.cl-tab.on{background:linear-gradient(#ff8f7c,#d8382a);color:#fff;box-shadow:0 3px 0 #9b2117}
.port .sh-head{flex-wrap:wrap;height:auto;row-gap:8px}.port .cl-tabs{order:3;flex:1 1 100%;justify-content:center}
.cl-body{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:minmax(200px,30%) 1fr;gap:16px;padding-top:8px}
.port .cl-body{grid-template-columns:1fr;grid-template-rows:minmax(0,34%) 1fr}
.cl-model{position:relative;align-self:center;justify-self:center;height:92%;aspect-ratio:340/442;max-width:100%}
.cl-model::before{content:"";position:absolute;left:-12%;right:-12%;bottom:-4%;height:16%;border-radius:50%;background:radial-gradient(ellipse at center,#c58a5070,transparent 70%)}
.cl-model.twirl{animation:hop .7s}
.cl-grid{min-height:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:12px}
.cl-grid.t-ov{grid-template-columns:repeat(3,minmax(0,1fr))}
.port .cl-grid.t-decor{grid-template-columns:repeat(4,minmax(0,1fr))}
.cl-item{position:relative;border:0;border-radius:22px;padding:8px;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;background:linear-gradient(#ffffff,#fff4de);box-shadow:0 4px 0 #dcb382,0 7px 12px #5a3a1420}
.cl-item.on{background:linear-gradient(#fffbe0,#ffec9e);box-shadow:0 4px 0 #e0a800,0 0 0 4px #ffd23f}
.cl-item.locked .cl-art{filter:grayscale(1) brightness(1.15) opacity(.45)}
.cl-art{display:block;flex:1 1 auto;width:100%;min-height:0;background-position:center;background-repeat:no-repeat;background-size:contain}
.cl-t{font-size:18px;font-weight:900;color:#6b3a16;line-height:1.05;text-align:center}
.cl-need{font-size:14px;font-weight:800;color:#a0461f;text-align:center;line-height:1.1}
.lock{position:absolute;top:8px;right:8px;width:32px;height:32px;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='4' y='10' width='16' height='12' rx='3' fill='%23a0461f'/><path d='M8 10V7a4 4 0 0 1 8 0v3' fill='none' stroke='%23a0461f' stroke-width='2.6'/><circle cx='12' cy='16' r='2' fill='%23fff'/></svg>") center/contain no-repeat}
.i-hat-straw{background-image:url(assets/hat-straw.png)}.i-hat-cap{background-image:url(assets/hat-cap.png)}.i-hat-flowers{background-image:url(assets/hat-flowers.png)}
.i-hat-beanie{background-image:url(assets/hat-beanie.png)}.i-hat-cowboy{background-image:url(assets/hat-cowboy.png)}.i-hat-rain{background-image:url(assets/hat-rain.png)}
.i-nohat{background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><circle cx='20' cy='20' r='14' fill='none' stroke='%23c9a97f' stroke-width='4'/><path d='M10 30L30 10' stroke='%23c9a97f' stroke-width='4' stroke-linecap='round'/></svg>");background-size:54%}
.i-ov-blue{background-image:url(assets/helper-blue.png)}.i-ov-red{background-image:url(assets/helper-red.png)}.i-ov-green{background-image:url(assets/helper-green.png)}
.i-ov-yellow{background-image:url(assets/helper-yellow.png)}.i-ov-purple{background-image:url(assets/helper-purple.png)}.i-ov-pink{background-image:url(assets/helper-pink.png)}
.i-dec-sunflowers{background-image:url(assets/dec-sunflowers.png)}.i-dec-flowerbox{background-image:url(assets/dec-flowerbox.png)}.i-dec-hay{background-image:url(assets/dec-hay.png)}
.i-dec-vane{background-image:url(assets/dec-vane.png)}.i-dec-pumpkins{background-image:url(assets/dec-pumpkins.png)}.i-dec-lantern{background-image:url(assets/dec-lantern.png)}
.i-dec-bunting{background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 34'><path d='M2 4Q30 16 58 4' stroke='%237a4c22' stroke-width='2' fill='none'/><path d='M6 6l8 3-3 14z' fill='%23e0493c'/><path d='M17 10l9 1-4 15z' fill='%23f7c935'/><path d='M29 11l9-1-4 15z' fill='%233d9be3'/><path d='M41 10l8-3-1 15z' fill='%235cb84b'/><path d='M51 7l6-3 0 13z' fill='%23f27aaa'/></svg>")}

/* ---------- portrait tweaks ---------- */
.port .hbtn{width:70px;height:70px}
.port .p-head h2{font-size:30px}
.port .cgrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.port .cgrid .cbtn{aspect-ratio:auto}
.port .cgrid.n6{grid-template-columns:repeat(3,minmax(0,1fr))}
.port .cbtn{padding:4px;border-radius:14px}
.port.short .wl{font-size:17px}
.port.short .p-head{height:44px}.port.short .p-head h2{font-size:26px}.port.short .p-step{width:42px;height:42px;font-size:22px}
.port.short .preview{width:104px;height:104px}.port.short .preview .blk{width:90px;height:90px}
.port.short .qbtn{width:96px;height:96px;font-size:42px}
.port.short .q-t{font-size:26px}
.port.short .dial{width:86px;height:86px}.port.short .dial .sun{inset:21px}.port.short .dial .hand{height:34px;transform-origin:50% 33px}
.port.short .tframe{grid-template-columns:repeat(5,46px);grid-auto-rows:46px}
.port.short .tframe.five{grid-template-columns:repeat(5,84px);grid-auto-rows:84px}
.port.short .pile{width:112px;height:112px}
.port.short .tens-wrap{min-height:170px}.port.short .tstick{height:170px}
.port.short .pz-ch{width:118px;height:118px}
.land .pz-body.stk .tframes{flex-direction:row}
.land .pz-body.stk .stk-area{gap:16px}
.little .wl{font-size:26px}
.f-sheep,.f-goat{z-index:3}
.tag-layer{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;z-index:4}
.tag-layer>*{position:absolute}
.port .cgrid .cbtn{overflow:hidden;padding:6px;height:118px}.port .cgrid .cbtn .blk{width:auto;height:100%;max-width:100%}
.short .cgrid .cbtn{height:80px;padding:4px}.short .cgrid{gap:6px}
.port.short .preview{width:88px;height:88px;border-radius:18px}.port.short .preview .blk{width:76px;height:76px}.port.short .add{height:66px;font-size:26px}.port.short .dz-hint{font-size:15px}.port.short .c-top .tbtn{height:46px}.short .cgrid .cbtn{height:74px}

.port .cgrid.n6{flex:0 0 auto}.port .cgrid.n6 .cbtn{height:140px}.port.short .cgrid.n6 .cbtn{height:96px}
.cl-model{container-type:size}
.h-fig{position:absolute;left:50%;bottom:0;transform:translateX(-50%);width:min(100cqw,76.9cqh);aspect-ratio:340/442}
.h-fig .h-body{height:100%;width:100%}
.port .cl-model{height:80%;align-self:end}
