/* Math picture-book surface. Every selector is scoped to .math-game. */
.math-game{--ink:#405c4c;--paper:#fff7e6;--paper-deep:#f4e4c3;--green:#759675;--green-dark:#416553;--coral:#dc8969;--yellow:#e9bd70;--shadow:0 12px 28px rgba(64,92,76,.16);color:var(--ink);font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif;min-height:calc(100vh - 88px);background:#e7efe3;position:relative;overflow:hidden}.math-game button,.math-game select{font:inherit}.math-game button{cursor:pointer}.math-game button:disabled{cursor:default;opacity:.42}.math-game svg{max-width:100%;height:auto}.math-game-header{display:flex;align-items:center;gap:14px;max-width:1180px;margin:0 auto;padding:16px 24px 10px;position:relative;z-index:4}.math-game-header h1{font-size:clamp(21px,2.4vw,32px);line-height:1.1;margin:3px 0 0;font-weight:800}.math-game-eyebrow,.math-game-kicker{font-size:12px;letter-spacing:.12em;color:#69856c;font-weight:700}.math-game-back{border:0;background:#fffaf0;border-radius:50%;width:44px;height:44px;font-size:32px;line-height:1;color:var(--ink);box-shadow:0 4px 10px rgba(64,92,76,.12)}.math-game-parent-button,.math-game-exit{margin-left:auto;border:1px solid #b4c9b2;border-radius:999px;padding:8px 14px;background:#f8f0db;color:var(--ink);font-weight:700}.math-game-topline{position:relative;z-index:5;max-width:1180px;margin:0 auto;padding:12px 24px 0;display:flex;gap:12px;align-items:center;font-size:13px;font-weight:700}.math-game-topline>span:first-child{font-size:15px}.math-game-exit{font-size:12px;margin-left:auto}.math-game-scene{height:260px;position:relative;max-width:1180px;margin:0 auto;overflow:hidden;border-radius:24px;background:#d9e7d5;box-shadow:var(--shadow)}.math-game-scene>svg,.math-game-scene>div:first-child{width:100%;height:100%;display:block}.math-game-scene-caption{position:absolute;left:22px;top:18px;background:rgba(255,249,232,.9);padding:8px 13px;border-radius:13px;font-weight:700;font-size:14px}.math-game-dog{position:absolute;left:9%;bottom:5px;width:125px;height:170px;z-index:3}.math-game-dog .dog{width:100%;height:100%}.math-game-friend-large{display:flex;flex-direction:column;align-items:center;gap:4px;position:absolute;left:28%;bottom:24px;width:112px;font-weight:800}.math-game-friend-large svg,.math-game-friend-large>span,.math-game-fork-friend svg,.math-game-result-character svg,.math-game-ending-friend svg,.math-game-home-friend svg,.math-game-character-line svg{width:84px;height:110px}.math-game-friend-fallback{display:grid;place-items:center;width:70px;height:70px;border-radius:50%;background:#f1c79a;font-size:30px;border:3px solid var(--ink)}.math-game-companions{position:absolute;right:7%;bottom:10px;display:flex;gap:6px;align-items:end}.math-game-companions>div{display:flex;flex-direction:column;align-items:center;font-size:11px;font-weight:800}.math-game-companions svg{width:64px;height:82px}.math-game-cottage-content{max-width:1020px;margin:-8px auto 0;position:relative;z-index:2;padding:0 22px 36px}.math-game-invite-card{display:grid;grid-template-columns:45% 1fr;gap:16px;align-items:center;background:var(--paper);border:1px solid rgba(64,92,76,.15);border-radius:24px;padding:18px 22px;box-shadow:var(--shadow)}.math-game-invite-characters{min-height:160px;position:relative;background:#e5eee1;border-radius:18px;overflow:hidden}.math-game-invite-characters .math-game-dog{bottom:-14px;left:14%;width:95px;height:135px}.math-game-invite-characters .math-game-friend-large{left:auto;right:16%;bottom:9px}.math-game-invite-characters .math-game-friend-large svg{width:74px;height:94px}.math-game-invite-copy h2{font-size:clamp(21px,3vw,30px);margin:5px 0 6px}.math-game-invite-copy p{margin:4px 0;line-height:1.6}.math-game-goal{background:#f2e4c6;border-radius:12px;padding:8px 11px;margin-top:12px!important}.math-game-section-title{display:flex;align-items:baseline;gap:10px;margin:20px 0 10px}.math-game-section-title h2{font-size:18px;margin:0}.math-game-section-title span{font-size:12px;color:#6d856c}.math-game-friend-picker{margin-top:22px}.math-game-friend-row{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 12px;scrollbar-width:thin}.math-game-friend-card{border:1px solid #c9d6be;background:#fbf4df;border-radius:17px;min-width:115px;padding:10px 8px;display:flex;flex-direction:column;align-items:center;gap:3px;color:var(--ink);transition:.2s box-shadow,.2s transform}.math-game-friend-card.selected{border-color:var(--green-dark);background:#e0eddb;box-shadow:0 5px 0 #b2c9a6;transform:translateY(-3px)}.math-game-friend-card svg{width:65px;height:78px}.math-game-friend-card span{font-weight:800}.math-game-friend-card small{font-size:11px;color:#6c8069;white-space:nowrap}.math-game-buddy-picker{display:flex;align-items:center;gap:10px;font-size:13px;margin:4px 0 10px}.math-game-buddy-picker select{border:1px solid #aec5aa;background:#fffaf0;border-radius:10px;padding:6px;color:var(--ink)}.math-game-button{border:0;border-radius:999px;padding:11px 19px;min-height:42px;font-weight:800;transition:transform .15s,box-shadow .15s}.math-game-button.primary{background:var(--green-dark);color:white;box-shadow:0 5px 0 #304f43}.math-game-button.secondary{background:#f8efd9;color:var(--ink);border:1px solid #bfd0b6}.math-game-button:active{transform:translateY(2px);box-shadow:none}.math-game-friend-picker>.math-game-button{margin-top:5px}.math-game-collection{background:rgba(255,247,230,.8);border-radius:22px;padding:4px 18px 18px;margin-top:20px}.math-game-collection-grid{display:flex;gap:10px;overflow-x:auto;min-height:86px}.math-game-collection-slot{display:flex;align-items:center;gap:7px;min-width:125px;background:#fffaf0;border:1px solid #c5d3bb;border-radius:13px;padding:8px;color:var(--ink);text-align:left}.math-game-collection-slot.active{border-color:var(--coral);background:#fff0dc}.math-game-collection-slot svg{width:58px;height:50px}.math-game-collection-slot b{font-size:13px}.math-game-collection-response{background:#f2dfbd;border-radius:10px;padding:8px 11px;margin:10px 0 0;font-weight:700;font-size:13px}.math-game-muted,.math-game-helper-copy{color:#71816e;font-size:13px}.math-game-cottage-footer{display:flex;justify-content:space-between;align-items:center;margin-top:17px}.math-game-text-button{border:0;background:transparent;color:#537560;text-decoration:underline;padding:6px}.math-game-task-dots{display:flex;gap:7px;align-items:center}.math-game-task-dots i{width:9px;height:9px;border-radius:50%;background:#d1dbc8}.math-game-task-dots i.now{background:var(--coral);box-shadow:0 0 0 4px #f6dcc5}.math-game-task-dots i.done{background:var(--green-dark)}.math-game-station-top{max-width:1180px;margin:0 auto;padding:0 24px 8px;display:flex;justify-content:space-between;align-items:center;font-size:13px;font-weight:700}.math-game-work-area{max-width:1020px;margin:-18px auto 0;position:relative;z-index:3;padding:0 22px 30px}.math-game-quest,.math-game-work-card{background:var(--paper);border:1px solid rgba(64,92,76,.14);border-radius:22px;box-shadow:var(--shadow);padding:18px 20px}.math-game-quest{display:grid;grid-template-columns:1fr auto;gap:8px 16px;align-items:start}.math-game-quest-title{display:flex;justify-content:space-between;gap:12px}.math-game-quest-title h2{margin:4px 0 0;font-size:clamp(23px,3.2vw,35px);line-height:1.1}.math-game-audio{border:0;border-radius:999px;background:#e4eee0;color:var(--green-dark);padding:9px 13px;font-weight:800;white-space:nowrap}.math-game-audio.playing{background:#f5dfb4}.math-game-audio.failed{background:#f1cfc0;color:#914d3f}.math-game-brief{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:8px 18px;color:#54705c;font-size:14px}.math-game-brief p{margin:0}.math-game-audio-state{grid-column:1/-1;min-height:0;font-size:12px;margin:0;color:#71816e}.math-game-audio-state.failed{color:#9d5047}.math-game-character-line{grid-column:1/-1;display:flex;align-items:center;gap:8px;border-top:1px solid #e4e4ce;padding-top:8px;font-size:13px}.math-game-character-line svg{width:44px;height:56px}.math-game-work-card{margin-top:14px}.math-game-work-title{display:flex;align-items:center;gap:12px;border-bottom:1px solid #e3e4cf;padding-bottom:10px;margin-bottom:10px}.math-game-work-title h2{font-size:17px;margin:0}.math-game-hand{min-height:200px}.math-game-material{display:flex;align-items:center;justify-content:space-between;background:#eef3e8;border-radius:16px;padding:7px 14px;margin-bottom:12px}.math-game-material svg{width:90px;max-height:62px}.math-game-material-label{font-size:13px;font-weight:700}.math-game-place-value,.math-game-token-row,.math-game-chip-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.math-game-place-value{display:grid;grid-template-columns:1fr 1fr;gap:12px}.math-game-place-value>div{background:#f4ead4;border-radius:15px;padding:11px}.math-game-place-value h3,.math-game-compose-table h3{font-size:14px;margin:0 0 7px}.math-game-token{border:0;background:#fff5de;border-radius:10px;padding:4px;min-width:48px;min-height:42px}.math-game-token svg{width:42px;height:38px}.math-game-token.kind-number{font-size:20px;font-weight:900;min-width:54px}.math-game-empty{font-size:13px;color:#85947e}.math-game-more{font-weight:800;color:#71816e}.math-game-small-buttons{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}.math-game-small-buttons button,.math-game-carry-row button{border:1px solid #b9cdb2;background:#fff9eb;border-radius:10px;padding:7px 10px;color:var(--ink);font-size:12px}.math-game-equation{display:flex;gap:9px;align-items:center;justify-content:center;background:#f8edcf;border-radius:13px;padding:10px;margin:13px 0;font-size:17px}.math-game-equation strong{color:var(--green-dark)}.math-game-controls{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}.math-game-help,.math-game-undo{border:0;background:transparent;text-decoration:underline;color:#537560;padding:7px}.math-game-undo:disabled{color:#a9b2a4}.math-game-submit-bar{display:flex;justify-content:center;margin-top:10px}.math-game-submit-bar .math-game-button{min-width:180px}.math-game-process-title,.math-game-choice-context,.math-game-pair-target,.math-game-path-rule{background:#f4ead3;border-radius:13px;padding:9px 12px;margin-bottom:11px;font-weight:700}.math-game-compose-table{display:grid;grid-template-columns:1fr auto 1fr;gap:12px;align-items:center}.math-game-loose,.math-game-bundles,.math-game-two-piles{background:#eef3e8;border-radius:15px;padding:11px}.math-game-compose-action{display:flex;flex-direction:column;gap:8px}.math-game-big-action{border:0;background:var(--coral);color:white;border-radius:999px;padding:10px;font-weight:800}.math-game-two-piles{display:flex;gap:12px;justify-content:center}.math-game-pile{border:1px solid #c8d5bd;background:#fff8e9;border-radius:14px;padding:10px;font-weight:800}.math-game-pile svg{width:100px;height:62px}.math-game-drop-mat{background:#e9dfbd;border:2px dashed #b8a875;border-radius:18px;min-height:68px;margin:10px 0;display:flex;align-items:center;justify-content:center;gap:8px;font-size:17px}.math-game-drop-mat.filled{background:#dbe8d1;border-color:#80a077}.math-game-split-table{display:grid;grid-template-columns:1fr 1fr;gap:12px}.math-game-bundle-source,.math-game-split-result{background:#eef3e8;border-radius:15px;padding:14px;text-align:center;display:flex;flex-direction:column;gap:9px;align-items:center}.math-game-bundle-source svg{width:140px;height:90px}.math-game-bundle-source button{border:0;background:var(--coral);color:white;border-radius:999px;padding:8px 12px;font-weight:800}.math-game-piles,.math-game-choice-grid,.math-game-link-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.math-game-pile-card,.math-game-choice-card,.math-game-link-card,.math-game-pair-card{border:1px solid #c9d6be;background:#fff9e9;border-radius:15px;padding:10px;min-height:75px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:var(--ink)}.math-game-pile-card.selected,.math-game-choice-card.selected,.math-game-link-card.selected,.math-game-pair-card.selected{border-color:var(--coral);background:#ffe9d0;box-shadow:0 0 0 3px #f7d2b0}.math-game-pile-card svg,.math-game-choice-card svg,.math-game-link-card svg,.math-game-pair-card svg{width:72px;height:48px}.math-game-pile-card strong,.math-game-choice-card strong,.math-game-link-card strong,.math-game-pair-card strong{font-size:17px}.math-game-find-target,.math-game-feed-target{background:#dfead6;border-radius:16px;padding:13px;font-size:20px;font-weight:900;margin-bottom:11px}.math-game-find-target small{display:block}.math-game-road-label{text-align:center;background:#f4ead3;border-radius:13px;padding:9px;font-size:16px}.math-game-road{height:72px;border-radius:35px;border:7px solid #ba9664;background:#f3dfb0;padding:5px;overflow:hidden;margin:14px 0;position:relative}.math-game-road-fill{height:100%;background:#d7b77d;border-radius:22px;display:flex;align-items:center;gap:2px;overflow:hidden;transition:width .2s}.math-game-road-fill svg{height:48px;width:58px;flex:none}.math-game-feed-layout{display:grid;grid-template-columns:1fr 180px;gap:16px;align-items:center}.math-game-feed-destination{border:2px dashed #8ea884;border-radius:22px;background:#e2efdc;min-height:130px;color:var(--green-dark);font-weight:900;padding:12px}.math-game-feed-destination.bowl{border-radius:50% 50% 27px 27px;background:#f0d5a2}.math-game-feed-destination.tray{border-radius:14px;background:#e7dec2}.math-game-feed-destination b{display:block;font-size:24px;margin-top:7px}.math-game-step-path{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;background:#e8e0c3;padding:17px;border-radius:18px}.math-game-step-tile{border:0;background:#f7f0db;border-radius:12px;min-height:72px;font-size:23px;font-weight:900;color:var(--ink);box-shadow:0 4px 0 #c3b586}.math-game-step-tile.stepped{background:#b6d2a9;box-shadow:0 4px 0 #779773;transform:translateY(3px)}.math-game-sort-slots{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:11px}.math-game-sort-slot{min-height:72px;border:2px dashed #b6c8ad;border-radius:13px;background:#f5edd5;display:grid;place-items:center;color:#789077;font-size:13px}.math-game-sort-slot button{border:0;background:#dfecd8;border-radius:12px;padding:13px 24px;font-size:22px;font-weight:900;color:var(--ink)}.math-game-flip-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;max-width:430px;margin:auto}.math-game-flip-card{min-height:100px;border:0;border-radius:15px;background:#75a080;color:white;font-size:28px;box-shadow:0 5px 0 #4e765c}.math-game-flip-card.open{background:#fff1d4;color:var(--ink);border:2px solid #d7ba7c;box-shadow:none}.math-game-flip-card.matched{background:#d7ead0;border-color:#7d9e78}.math-game-flip-card i{font-style:normal}.math-game-error-copy{color:#9b5849;background:#f5ddd0;border-radius:11px;padding:8px;font-size:13px}.math-game-catch-prompt{display:flex;justify-content:space-between;gap:10px;align-items:center;background:#f4ead3;border-radius:13px;padding:10px}.math-game-catch-board{height:230px;background:linear-gradient(#e5f0df,#c4dbba);border-radius:18px;position:relative;overflow:hidden;margin:11px 0}.math-game-falling-number{position:absolute;left:50%;top:35px;transform:translateX(-50%);border:0;background:#fff4cf;border-radius:50%;width:68px;height:68px;font-size:27px;font-weight:900;color:var(--ink);box-shadow:0 5px 0 #d7b972}.math-game-catch-basket{position:absolute;bottom:19px;left:50%;transform:translateX(-50%);width:165px;height:50px;border-radius:0 0 35px 35px;background:#c9985e;border:3px solid #7f5a3a;display:grid;place-items:center;font-weight:900}.math-game-catch-actions{display:flex;justify-content:space-between;align-items:center;gap:10px}.math-game-vertical-expression{background:#f4ead3;border-radius:14px;padding:13px;width:180px;text-align:right;margin:0 auto 12px;font-size:23px;line-height:1.45}.math-game-vertical-expression hr{border:0;border-top:2px solid var(--ink)}.math-game-place-columns{display:grid;grid-template-columns:1fr 1fr;gap:12px}.math-game-block-column{background:#eef3e8;border-radius:15px;padding:12px;text-align:center}.math-game-block-column h3{margin:0 0 8px}.math-game-blocks{min-height:55px;display:flex;justify-content:center;flex-wrap:wrap;gap:3px}.math-game-blocks svg{width:48px;height:45px}.math-game-carry-row{display:flex;justify-content:center;align-items:center;gap:8px;margin-top:12px;flex-wrap:wrap}.math-game-carry-row button.done{background:#bdd8b4}.math-game-scale-board{display:grid;grid-template-columns:1fr 110px 1fr;align-items:center;gap:8px;margin-bottom:12px}.math-game-scale-pan{min-height:90px;background:#eef3e8;border:2px solid #abc2a4;border-radius:15px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;font-size:20px}.math-game-scale-pan.right.filled{background:#d9ebd2}.math-game-scale-beam{text-align:center}.math-game-scale-beam i{display:block;border-top:7px solid #96714c;transform:rotate(-3deg);margin-bottom:12px}.math-game-scale-beam b{font-size:12px;color:#758770}.math-game-scale-target{display:flex;justify-content:space-between;background:#f4ead3;border-radius:13px;padding:9px 12px;margin-bottom:11px}.math-game-money-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:12px}.math-game-money-summary span{background:#f4ead3;border-radius:13px;padding:10px;display:flex;flex-direction:column;gap:4px}.math-game-coin-tray{background:#e1eddc;border-radius:16px;padding:12px;margin-bottom:12px}.math-game-coin-tray h3{font-size:14px;margin:0 0 8px}.math-game-coin-tray strong{display:block;margin-top:8px}.math-game-station-footer{max-width:1020px;padding:0 22px 24px;margin:-9px auto 0;display:flex;justify-content:space-between;align-items:center;gap:12px}.math-game-fork-card,.math-game-result-card,.math-game-ending-card,.math-game-home-card,.math-game-paused-card{max-width:820px;margin:-20px auto 28px;position:relative;z-index:2;background:var(--paper);border-radius:24px;box-shadow:var(--shadow);padding:22px}.math-game-fork-friend,.math-game-result-card,.math-game-ending-card,.math-game-home-card{display:flex;align-items:center;gap:18px}.math-game-route-choices{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-top:16px}.math-game-route-choice{border:1px solid #c0d1b7;background:#f8efd9;border-radius:17px;padding:14px;text-align:left;color:var(--ink);display:grid;grid-template-columns:1fr 80px;gap:4px 10px}.math-game-route-choice:hover{background:#e2eddb}.math-game-route-choice strong,.math-game-route-choice small{grid-column:1}.math-game-route-choice i{grid-column:2;grid-row:1/4;align-self:center}.math-game-route-choice i svg{width:75px;height:56px}.math-game-route-number{font-size:12px;color:#69876c}.math-game-result-card,.math-game-ending-card,.math-game-home-card{min-height:150px}.math-game-result-character,.math-game-ending-friend,.math-game-home-friend{background:#e2eddb;border-radius:17px;padding:9px;min-width:105px;display:grid;place-items:center}.math-game-result-card h2,.math-game-ending-card h2,.math-game-home-card h2{margin:0 0 8px;font-size:24px}.math-game-result-feedback{color:#537560;font-weight:800}.math-game-result-actions,.math-game-ending-actions,.math-game-home-actions{max-width:820px;margin:0 auto 25px;display:flex;justify-content:center;gap:10px;flex-wrap:wrap}.math-game-route-summary{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:10px;font-size:12px;color:#6a806a}.math-game-route-summary span{background:#e6efdf;padding:5px 8px;border-radius:8px}.math-game-route-summary i{font-style:normal}.math-game-paused-card{text-align:center;max-width:520px;margin:20px auto;padding:28px}.math-game-paused-card .math-game-dog{position:relative;left:auto;bottom:auto;margin:0 auto;height:145px;width:115px}.math-game-paused-card>div:last-child{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:15px}.math-game-parent-panel{position:fixed;z-index:20;right:18px;top:82px;bottom:18px;width:min(390px,calc(100vw - 36px));overflow:auto;background:#fff9ec;border:1px solid #c6d6be;border-radius:20px;box-shadow:0 18px 50px rgba(34,55,40,.28);padding:20px}.math-game-parent-panel h2{margin:0 0 4px}.math-game-parent-panel h3{margin:20px 0 6px;font-size:15px}.math-game-parent-close{float:right;border:0;background:transparent;text-decoration:underline;color:#537560}.math-game-parent-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.math-game-parent-metrics span,.math-game-parent-panel li{background:#f2e6ca;border-radius:10px;padding:8px;font-size:12px}.math-game-parent-metrics b{display:block;font-size:20px}.math-game-parent-panel ul{list-style:none;padding:0;margin:0;display:grid;gap:5px}.math-game-parent-panel li{display:flex;justify-content:space-between}.math-game-chapter-list{max-height:240px;overflow:auto}.math-game-parent-note{font-size:12px;color:#71816e;line-height:1.5}.math-game-item-fallback{display:inline-flex;align-items:center;gap:4px;font-size:18px;font-weight:800}.math-game-item-fallback i{font-style:normal;color:#c36e53}.math-game-facility-fallback{font-size:12px;color:#678667;font-weight:800}.math-game-fallback-scene{background:#dbe8d6}
.math-game [data-drop-kind].drag-over{outline:4px solid #edb66d;outline-offset:2px}.math-game .dragging{opacity:.58;transform:scale(1.05)}
@media (max-width:800px){.math-game{min-height:100vh}.math-game-header{padding:10px 14px 8px}.math-game-header h1{font-size:21px}.math-game-parent-button{font-size:12px;padding:7px 10px}.math-game-topline{padding:8px 14px 0}.math-game-scene{border-radius:0;height:210px}.math-game-dog{width:95px;height:135px;left:4%}.math-game-friend-large{left:28%;bottom:4px}.math-game-friend-large svg{width:70px;height:88px}.math-game-cottage-content,.math-game-work-area,.math-game-station-footer{padding-left:14px;padding-right:14px}.math-game-invite-card{grid-template-columns:1fr;padding:13px}.math-game-invite-characters{min-height:145px}.math-game-invite-copy h2{font-size:22px}.math-game-place-value,.math-game-split-table,.math-game-compose-table{grid-template-columns:1fr}.math-game-compose-action{order:3}.math-game-piles,.math-game-choice-grid,.math-game-link-cards{grid-template-columns:repeat(3,minmax(80px,1fr))}.math-game-feed-layout{grid-template-columns:1fr}.math-game-feed-destination{min-height:78px}.math-game-scale-board{grid-template-columns:1fr 70px 1fr}.math-game-money-summary{font-size:12px}.math-game-route-choices{grid-template-columns:1fr}.math-game-fork-card,.math-game-result-card,.math-game-ending-card,.math-game-home-card{margin:-9px 14px 20px;padding:16px}.math-game-fork-friend,.math-game-result-card,.math-game-ending-card,.math-game-home-card{align-items:flex-start}.math-game-result-character,.math-game-ending-friend,.math-game-home-friend{min-width:72px}.math-game-result-character svg,.math-game-ending-friend svg,.math-game-home-friend svg{width:60px;height:82px}.math-game-catch-prompt{align-items:flex-start;flex-direction:column}.math-game-station-top{padding:0 14px 7px;font-size:12px}.math-game-quest{grid-template-columns:1fr}.math-game-audio{justify-self:start}.math-game-quest-title{flex-direction:column}.math-game-brief{display:block}.math-game-brief p{margin-top:4px}.math-game-cottage-footer{align-items:flex-start;flex-direction:column}.math-game-companions{right:2%;transform:scale(.84);transform-origin:bottom right}}
@media (prefers-reduced-motion:reduce){.math-game *{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

/*
 * Picture-book stage layout, revision 2.
 * The scene is a painted backcloth; the child works on the table in front of
 * it.  Keep every rule under .math-game so the pinyin surface is untouched.
 */
.math-game {
  --math-ink: #244f48;
  --math-ink-soft: #557565;
  --math-paper: #fff8e9;
  --math-paper-warm: #f5e5bf;
  --math-leaf: #dce9d9;
  --math-leaf-deep: #b8cfb7;
  --math-sun: #edc36f;
  --math-coral: #d97e5f;
  --math-line: rgba(36, 79, 72, .22);
  --math-shadow: 0 10px 22px rgba(37, 69, 55, .14);
  box-sizing: border-box;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  color: var(--math-ink);
  background: #e9efdf;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
.math-game *,
.math-game *::before,
.math-game *::after { box-sizing: border-box; }
.math-game button,
.math-game select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.math-game button:focus-visible,
.math-game select:focus-visible { outline: 3px solid var(--math-coral); outline-offset: 3px; }
.math-game > .math-game-scene,
.math-game > .math-game-header,
.math-game > .math-game-topline,
.math-game > .math-game-station-top,
.math-game > .math-game-work-area,
.math-game > .math-game-cottage-content,
.math-game > .math-game-fork-card,
.math-game > .math-game-result-card,
.math-game > .math-game-result-actions,
.math-game > .math-game-ending-card,
.math-game > .math-game-ending-actions,
.math-game > .math-game-home-card,
.math-game > .math-game-collection,
.math-game > .math-game-home-actions,
.math-game > .math-game-paused-card { position: relative; }

/* A single painted stage shared by the cottage and outing screens. */
.math-game.math-game-cottage,
.math-game.math-game-station,
.math-game.math-game-fork,
.math-game.math-game-result,
.math-game.math-game-ending,
.math-game.math-game-home,
.math-game.math-game-paused { min-height: 100%; height: 100%; }
.math-game .math-game-scene {
  position: absolute;
  z-index: 0;
  inset: 68px 0 0;
  width: auto;
  max-width: none;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #dceadd;
  pointer-events: none;
  opacity: .94;
}
.math-game .math-game-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 18%, rgba(255,255,255,.24) 0 1px, transparent 1.5px),
    linear-gradient(180deg, rgba(255,255,255,.09), rgba(229,240,222,.14));
  background-size: 15px 15px, auto;
  mix-blend-mode: soft-light;
}
.math-game .math-game-scene > svg,
.math-game .math-game-scene > div:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.math-game .math-game-scene-caption {
  left: 28px;
  top: 22px;
  max-width: 250px;
  padding: 7px 12px;
  border: 1px solid rgba(36,79,72,.12);
  border-radius: 17px 17px 17px 5px;
  background: rgba(255,249,232,.86);
  color: var(--math-ink-soft);
  font-size: 13px;
}

/* The dog SVG comes from ToonCharacter.  Only its stage placement changes. */
.math-game .math-game-dog { z-index: 2; }
.math-game .math-game-companions { z-index: 2; }
.math-game .math-game-header {
  z-index: 8;
  width: 100%;
  max-width: 1240px;
  height: 68px;
  padding: 9px 28px 7px;
  margin: 0 auto;
  color: var(--math-ink);
}
.math-game .math-game-header h1 {
  margin: 2px 0 0;
  font-family: KaiTi, STKaiti, "Microsoft YaHei", sans-serif;
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 700;
  letter-spacing: .04em;
}
.math-game .math-game-eyebrow,
.math-game .math-game-kicker { color: var(--math-ink-soft); letter-spacing: .08em; }
.math-game .math-game-back {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(36,79,72,.45);
  background: rgba(255,249,232,.9);
  box-shadow: 0 3px 0 rgba(36,79,72,.12);
  font-size: 29px;
}
.math-game .math-game-parent-button,
.math-game .math-game-exit {
  min-height: 48px;
  padding: 9px 16px;
  border-color: rgba(36,79,72,.32);
  background: rgba(255,249,232,.82);
  color: var(--math-ink);
}
.math-game .math-game-topline,
.math-game .math-game-station-top {
  z-index: 7;
  width: 100%;
  max-width: 1240px;
  min-height: 34px;
  padding: 4px 28px 5px;
  margin: 0 auto;
  color: var(--math-ink-soft);
}
.math-game .math-game-topline { position: absolute; top: 68px; left: 0; right: 0; }
.math-game .math-game-topline > span:first-child { color: var(--math-ink); font-size: 14px; }
.math-game .math-game-exit { font-size: 12px; }
.math-game .math-game-station-top {
  position: absolute;
  top: 68px;
  left: 0;
  right: 0;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}
.math-game .math-game-station-top .math-game-task-dots { margin-inline: auto; }

/* Station: one compact goal card, one material table, one bottom action. */
.math-game .math-game-work-area {
  z-index: 3;
  width: min(1180px, 100%);
  height: calc(100% - 68px);
  max-width: none;
  padding: 106px 34px 53px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.math-game .math-game-quest {
  flex: 0 0 122px;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: start;
  padding: 13px 20px 11px;
  border: 1px solid rgba(36,79,72,.15);
  border-radius: 23px;
  background: rgba(255,248,233,.94);
  box-shadow: var(--math-shadow);
}
.math-game .math-game-quest-title { min-width: 0; align-items: start; }
.math-game .math-game-quest-title h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--math-ink);
  font-family: KaiTi, STKaiti, "Microsoft YaHei", sans-serif;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.08;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}
.math-game .math-game-audio {
  min-width: 84px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid rgba(36,79,72,.18);
  background: #e1eedf;
  color: var(--math-ink);
}
.math-game .math-game-brief {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px 20px;
  overflow: hidden;
  color: var(--math-ink-soft);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
}
.math-game .math-game-brief p { overflow: hidden; text-overflow: ellipsis; }
.math-game .math-game-audio-state { grid-column: 1 / -1; height: 0; min-height: 0; margin: -2px 0 0; overflow: hidden; }
.math-game .math-game-character-line {
  grid-column: 1 / -1;
  min-height: 35px;
  padding-top: 4px;
  border-top-color: rgba(36,79,72,.14);
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
}
.math-game .math-game-character-line svg { flex: 0 0 auto; width: 34px; height: 42px; }
.math-game .math-game-work-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 11px 0 0;
  padding: 11px 18px 8px;
  border: 1px solid rgba(36,79,72,.15);
  border-radius: 23px;
  background: rgba(255,248,233,.93);
  box-shadow: var(--math-shadow);
  overflow: hidden;
}
.math-game .math-game-work-title {
  flex: 0 0 31px;
  min-height: 31px;
  gap: 10px;
  margin: 0 0 7px;
  padding: 0 0 7px;
  border-bottom-color: rgba(36,79,72,.14);
  overflow: hidden;
}
.math-game .math-game-work-title h2 {
  overflow: hidden;
  margin: 0;
  color: var(--math-ink);
  font-family: KaiTi, STKaiti, "Microsoft YaHei", sans-serif;
  font-size: 20px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.math-game .math-game-hand {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(85,117,101,.35) transparent;
}
.math-game .math-game-hand > .math-game-controls { margin-top: auto; }
.math-game .math-game-controls {
  flex: 0 0 auto;
  min-height: 37px;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
  padding-top: 4px;
}
.math-game .math-game-help,
.math-game .math-game-undo { min-height: 42px; padding: 8px 10px; }
.math-game .math-game-submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  flex: 0 0 auto;
  min-height: 64px;
  align-items: center;
  margin: 0;
  padding: 9px 0 1px;
  background: linear-gradient(180deg, rgba(255,248,233,0), rgba(255,248,233,.98) 28%);
}
.math-game .math-game-submit-bar .math-game-button {
  min-width: 235px;
  min-height: 56px;
  padding: 12px 22px;
  font-size: 17px;
  box-shadow: 0 4px 0 #2c5549;
}
.math-game .math-game-station-footer {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: none;
  min-height: 48px;
  margin: 0;
  padding: 4px 34px 9px;
  background: linear-gradient(180deg, rgba(233,239,223,0), rgba(233,239,223,.94) 32%);
}

/* Materials: stable touch targets and a hand-drawn paper table. */
.math-game .math-game-hand > * { flex-shrink: 0; }
.math-game .math-game-process-title,
.math-game .math-game-choice-context,
.math-game .math-game-pair-target,
.math-game .math-game-path-rule,
.math-game .math-game-find-target,
.math-game .math-game-feed-target,
.math-game .math-game-scale-target {
  min-height: 48px;
  margin: 0 0 8px;
  padding: 9px 13px;
  border: 1px solid rgba(36,79,72,.08);
  border-radius: 15px 12px 15px 8px;
  background: rgba(245,229,191,.74);
  color: var(--math-ink);
  line-height: 1.45;
}
.math-game .math-game-material-bank,
.math-game .math-game-shelf-compute-source,
.math-game .math-game-block-source-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}
.math-game .math-game-material-bank > span { grid-column: 1 / -1; color: var(--math-ink-soft); font-weight: 800; }
.math-game .math-game-material-source,
.math-game .math-game-block-source button {
  min-height: 76px;
  padding: 6px 10px;
  border: 1px solid rgba(36,79,72,.18);
  border-radius: 15px;
  background: #e2efdf;
  color: var(--math-ink);
}
.math-game .math-game-material-source svg,
.math-game .math-game-block-source button svg { width: 58px; height: 46px; vertical-align: middle; }
.math-game .math-game-token,
.math-game .math-game-material-source,
.math-game .math-game-pile,
.math-game .math-game-pile-card,
.math-game .math-game-choice-card,
.math-game .math-game-link-card,
.math-game .math-game-pair-card,
.math-game .math-game-sort-slot,
.math-game .math-game-step-tile,
.math-game .math-game-flip-card,
.math-game .math-game-shelf-zone,
.math-game .math-game-feed-destination {
  min-height: 64px;
  border-radius: 15px;
}
.math-game .math-game-token { min-width: 64px; padding: 5px; }
.math-game .math-game-token svg { width: 51px; height: 44px; }
.math-game .math-game-token.kind-number { min-width: 64px; font-size: 22px; }
.math-game .math-game-token-row,
.math-game .math-game-chip-row { gap: 9px; }
.math-game .math-game-place-value,
.math-game .math-game-split-table,
.math-game .math-game-compose-table {
  gap: 10px;
}
.math-game .math-game-place-value > div,
.math-game .math-game-loose,
.math-game .math-game-bundles,
.math-game .math-game-two-piles,
.math-game .math-game-bundle-source,
.math-game .math-game-split-result,
.math-game .math-game-block-column,
.math-game .math-game-scale-pan,
.math-game .math-game-coin-tray {
  border: 1px solid rgba(36,79,72,.09);
  border-radius: 16px;
  background: rgba(226,239,223,.86);
}
.math-game .math-game-place-value > div { min-height: 112px; padding: 11px; }
.math-game .math-game-place-value h3,
.math-game .math-game-compose-table h3 { margin: 0 0 6px; font-size: 15px; }
.math-game .math-game-small-buttons { gap: 8px; margin-top: 7px; }
.math-game .math-game-small-buttons button,
.math-game .math-game-carry-row button { min-height: 46px; padding: 8px 11px; border-radius: 11px; }
.math-game .math-game-equation {
  min-height: 45px;
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 13px 9px 13px 9px;
  background: rgba(245,229,191,.8);
  font-size: 17px;
}
.math-game .math-game-big-action { min-height: 56px; padding: 11px 16px; }
.math-game .math-game-drop-mat { min-height: 70px; margin: 8px 0 0; }
.math-game .math-game-piles,
.math-game .math-game-choice-grid,
.math-game .math-game-link-cards { gap: 9px; }
.math-game .math-game-pile-card,
.math-game .math-game-choice-card,
.math-game .math-game-link-card,
.math-game .math-game-pair-card { min-height: 86px; padding: 8px; }
.math-game .math-game-pile-card svg,
.math-game .math-game-choice-card svg,
.math-game .math-game-link-card svg,
.math-game .math-game-pair-card svg { width: 65px; height: 46px; }
.math-game .math-game-road { height: 78px; margin: 9px 0; }
.math-game .math-game-road-fill svg { width: 60px; height: 50px; }
.math-game .math-game-feed-layout { grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; }
.math-game .math-game-feed-destination { min-height: 118px; padding: 12px; }
.math-game .math-game-step-path { gap: 9px; padding: 12px; }
.math-game .math-game-step-tile { min-height: 68px; }
.math-game .math-game-sort-slots { gap: 9px; margin-bottom: 9px; }
.math-game .math-game-sort-slot { min-height: 68px; }
.math-game .math-game-sort-slot button { min-height: 54px; padding: 9px 20px; }
.math-game .math-game-flip-grid { gap: 9px; }
.math-game .math-game-flip-card { min-height: 86px; }
.math-game .math-game-catch-board { height: 190px; margin: 8px 0; }
.math-game .math-game-falling-number { width: 64px; height: 64px; }
.math-game .math-game-vertical-expression { margin: 0 auto 8px; padding: 8px 13px; }
.math-game .math-game-blocks svg { width: 43px; height: 40px; }
.math-game .math-game-scale-board { grid-template-columns: minmax(0,1fr) 90px minmax(0,1fr); gap: 8px; }
.math-game .math-game-scale-pan { min-height: 78px; }
.math-game .math-game-money-summary { gap: 8px; margin-bottom: 8px; }
.math-game .math-game-money-summary span { min-height: 58px; padding: 8px; border-radius: 13px; }
.math-game .math-game-coin-tray { min-height: 82px; padding: 10px; margin-bottom: 8px; }

/* Cottage: invitation first, companions second, archives stay visible but compact. */
.math-game.math-game-cottage .math-game-scene { inset: 68px 0 0; }
.math-game .math-game-cottage-content {
  z-index: 3;
  width: min(1180px, 100%);
  height: calc(100% - 68px);
  max-width: none;
  padding: 75px 30px 12px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(270px, .75fr);
  grid-template-rows: minmax(168px, 190px) minmax(145px, 165px) 96px 31px;
  gap: 10px 16px;
  overflow: hidden;
}
.math-game .math-game-invite-card {
  grid-column: 1 / -1;
  min-height: 0;
  grid-template-columns: minmax(250px, .52fr) 1fr;
  gap: 18px;
  padding: 13px 18px;
  border: 1px solid rgba(36,79,72,.14);
  border-radius: 24px;
  background: rgba(255,248,233,.93);
  box-shadow: var(--math-shadow);
}
.math-game .math-game-invite-characters { min-height: 0; background: rgba(225,239,222,.86); border-radius: 17px; }
.math-game .math-game-invite-characters .math-game-dog { width: 92px; height: 128px; }
.math-game .math-game-invite-characters .math-game-friend-large { width: 100px; }
.math-game .math-game-invite-characters .math-game-friend-large svg { width: 68px; height: 86px; }
.math-game .math-game-invite-copy { min-width: 0; align-self: center; }
.math-game .math-game-invite-copy h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 3px 0 4px;
  font-family: KaiTi, STKaiti, "Microsoft YaHei", sans-serif;
  font-size: clamp(25px, 3vw, 35px);
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}
.math-game .math-game-invite-copy p { margin: 4px 0; overflow: hidden; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.math-game .math-game-goal { min-height: 47px; margin: 8px 0 0 !important; padding: 7px 11px; border-radius: 13px; background: rgba(245,229,191,.9); }
.math-game .math-game-friend-picker {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
  padding: 10px 14px 9px;
  border: 1px solid rgba(36,79,72,.13);
  border-radius: 20px;
  background: rgba(239,245,231,.88);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 27px minmax(0, 1fr) auto;
  gap: 4px 14px;
}
.math-game .math-game-section-title { min-width: 0; gap: 9px; margin: 0; }
.math-game .math-game-section-title h2 { font-family: KaiTi, STKaiti, "Microsoft YaHei", sans-serif; font-size: 19px; }
.math-game .math-game-section-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.math-game .math-game-friend-row { min-width: 0; grid-column: 1; gap: 9px; padding: 1px 2px 5px; overflow-x: auto; overflow-y: hidden; }
.math-game .math-game-friend-card {
  flex: 0 0 106px;
  min-width: 106px;
  min-height: 104px;
  padding: 6px 7px;
  border-radius: 15px;
  background: rgba(255,248,233,.88);
}
.math-game .math-game-friend-card svg { width: 49px; height: 59px; }
.math-game .math-game-friend-card.selected { box-shadow: 0 3px 0 #9fb99d; transform: translateY(-2px); }
.math-game .math-game-friend-picker > .math-game-button { align-self: center; grid-column: 2; grid-row: 2; min-width: 155px; min-height: 60px; margin: 0; }
.math-game .math-game-buddy-picker { grid-column: 1 / -1; grid-row: 3; margin: 0; }
.math-game .math-game-collection,
.math-game .math-game-review-book {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(36,79,72,.12);
  border-radius: 18px;
  background: rgba(255,248,233,.82);
  overflow: hidden;
}
.math-game .math-game-review-book { grid-column: 2; }
.math-game .math-game-collection-grid,
.math-game .math-game-review-grid { min-width: 0; min-height: 52px; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; }
.math-game .math-game-collection-grid { align-items: center; }
.math-game .math-game-collection-slot,
.math-game .math-game-review-station { flex: 0 0 auto; min-height: 56px; min-width: 112px; padding: 7px 9px; border-radius: 12px; }
.math-game .math-game-collection-slot svg { width: 42px; height: 37px; }
.math-game .math-game-review-station { border: 1px solid rgba(36,79,72,.18); background: #e1eedf; color: var(--math-ink); text-align: left; }
.math-game .math-game-review-station span,
.math-game .math-game-review-station small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.math-game .math-game-review-station span { font-weight: 800; }
.math-game .math-game-review-station small { color: var(--math-ink-soft); font-size: 11px; }
.math-game .math-game-collection-response { margin: 5px 0 0; padding: 5px 8px; font-size: 11px; }
.math-game .math-game-cottage-footer {
  grid-column: 1 / -1;
  min-height: 31px;
  margin: 0;
  padding: 0 4px;
  color: var(--math-ink-soft);
}
.math-game .math-game-cottage-footer .math-game-text-button { min-height: 31px; padding: 5px 4px; }

/* Secondary story cards still sit on the stage instead of creating a long page. */
.math-game.math-game-fork .math-game-fork-card,
.math-game.math-game-result .math-game-result-card,
.math-game.math-game-ending .math-game-ending-card,
.math-game.math-game-home .math-game-home-card {
  z-index: 3;
  width: min(850px, calc(100% - 68px));
  margin: 94px auto 0;
  padding: 18px 22px;
  border: 1px solid rgba(36,79,72,.14);
  border-radius: 22px;
  background: rgba(255,248,233,.94);
  box-shadow: var(--math-shadow);
}
.math-game .math-game-route-choices { gap: 10px; margin-top: 12px; }
.math-game .math-game-route-choice { min-height: 88px; padding: 12px; }
.math-game .math-game-result-actions,
.math-game .math-game-ending-actions,
.math-game .math-game-home-actions { z-index: 3; margin: 12px auto 0; }
.math-game .math-game-home .math-game-home-card { margin-top: 94px; }
.math-game .math-game-home .home-collection { z-index: 3; width: min(850px, calc(100% - 68px)); margin: 12px auto 0; }
.math-game .math-game-parent-panel { z-index: 20; border-color: rgba(36,79,72,.24); background: #fff8e9; }

/* 1024x768 still gets the full station in one viewport. */
@media (min-width: 801px) and (max-height: 820px) {
  .math-game .math-game-header { height: 58px; padding-block: 6px; }
  .math-game .math-game-scene { inset: 58px 0 0; }
  .math-game .math-game-topline,
  .math-game .math-game-station-top { top: 58px; min-height: 30px; padding-inline: 24px; }
  .math-game .math-game-work-area { height: calc(100% - 58px); padding: 90px 24px 48px; }
  .math-game .math-game-quest { flex-basis: 106px; padding: 10px 17px 8px; }
  .math-game .math-game-quest-title h2 { font-size: 29px; }
  .math-game .math-game-character-line { min-height: 30px; }
  .math-game .math-game-character-line svg { width: 29px; height: 36px; }
  .math-game .math-game-work-card { margin-top: 8px; padding: 8px 15px 5px; }
  .math-game .math-game-work-title { flex-basis: 27px; min-height: 27px; margin-bottom: 4px; padding-bottom: 4px; }
  .math-game .math-game-submit-bar { min-height: 57px; }
  .math-game .math-game-submit-bar .math-game-button { min-height: 50px; }
  .math-game .math-game-cottage-content { height: calc(100% - 58px); padding-top: 61px; grid-template-rows: 155px 139px 82px 28px; gap: 8px 12px; }
  .math-game .math-game-invite-card { padding: 10px 15px; }
  .math-game .math-game-friend-picker { padding: 7px 11px; grid-template-rows: 23px minmax(0, 1fr) auto; }
  .math-game .math-game-friend-card { min-height: 92px; }
  .math-game .math-game-friend-card svg { width: 42px; height: 51px; }
  .math-game .math-game-friend-picker > .math-game-button { min-height: 54px; }
  .math-game .math-game-scene-caption { top: 16px; }
}

/* Phone portrait: let the picture book breathe vertically, never sideways. */
@media (max-width: 800px) {
  .math-game {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .math-game .math-game-scene { inset: 58px 0 auto; height: 790px; min-height: 790px; }
  .math-game .math-game-header { height: 58px; min-height: 58px; padding: 7px 14px; }
  .math-game .math-game-header h1 { font-size: 23px; }
  .math-game .math-game-back { width: 46px; height: 46px; }
  .math-game .math-game-parent-button,
  .math-game .math-game-exit { min-height: 44px; padding: 7px 10px; font-size: 12px; }
  .math-game .math-game-topline,
  .math-game .math-game-station-top { top: 58px; min-height: 31px; padding: 4px 14px; font-size: 11px; }
  .math-game .math-game-work-area {
    width: 100%;
    height: auto;
    min-height: calc(100dvh - 58px);
    padding: 98px 12px 18px;
    overflow: visible;
  }
  .math-game .math-game-quest {
    flex-basis: auto;
    min-height: 142px;
    padding: 12px 13px 10px;
    border-radius: 18px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
  }
  .math-game .math-game-quest-title h2 { font-size: clamp(23px, 7vw, 30px); -webkit-line-clamp: 2; }
  .math-game .math-game-audio { min-width: 74px; min-height: 46px; padding: 7px 9px; font-size: 12px; }
  .math-game .math-game-brief { display: block; font-size: 12px; white-space: normal; }
  .math-game .math-game-brief p { margin: 2px 0; }
  .math-game .math-game-character-line { min-height: 34px; font-size: 11px; }
  .math-game .math-game-work-card {
    min-height: 500px;
    margin-top: 10px;
    padding: 10px 11px 7px;
    border-radius: 18px;
    overflow: visible;
  }
  .math-game .math-game-work-title { flex-basis: 34px; min-height: 34px; }
  .math-game .math-game-work-title h2 { font-size: 18px; }
  .math-game .math-game-hand { overflow: visible; }
  .math-game .math-game-submit-bar { position: sticky; min-height: 64px; }
  .math-game .math-game-submit-bar .math-game-button { width: min(100%, 310px); min-width: 0; min-height: 56px; font-size: 16px; }
  .math-game .math-game-place-value,
  .math-game .math-game-split-table,
  .math-game .math-game-compose-table { grid-template-columns: minmax(0, 1fr); }
  .math-game .math-game-compose-action { order: 3; }
  .math-game .math-game-choice-grid,
  .math-game .math-game-piles,
  .math-game .math-game-link-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .math-game .math-game-feed-layout { grid-template-columns: minmax(0, 1fr); }
  .math-game .math-game-feed-destination { min-height: 84px; }
  .math-game .math-game-scale-board { grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); }
  .math-game .math-game-scale-pan { min-height: 78px; font-size: 16px; }
  .math-game .math-game-catch-board { height: 210px; }
  .math-game .math-game-station-footer { position: relative; min-height: 50px; padding: 4px 12px 14px; margin: 0; font-size: 11px; }
  .math-game .math-game-station-footer .math-game-button { min-height: 44px; }

  .math-game.math-game-cottage .math-game-scene { height: 790px; min-height: 790px; }
  .math-game .math-game-cottage-content {
    width: 100%;
    height: auto;
    min-height: calc(100dvh - 58px);
    padding: 66px 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
  }
  .math-game .math-game-invite-card {
    flex: 0 0 190px;
    grid-template-columns: 40% 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
  }
  .math-game .math-game-invite-characters .math-game-dog { width: 68px; height: 98px; left: 8%; }
  .math-game .math-game-invite-characters .math-game-friend-large { right: 4%; width: 72px; }
  .math-game .math-game-invite-characters .math-game-friend-large svg { width: 55px; height: 70px; }
  .math-game .math-game-invite-copy h2 { font-size: 24px; -webkit-line-clamp: 2; }
  .math-game .math-game-invite-copy p { font-size: 12px; white-space: normal; }
  .math-game .math-game-goal { min-height: 47px; font-size: 12px; }
  .math-game .math-game-friend-picker {
    flex: 0 0 214px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 9px 10px;
    border-radius: 18px;
  }
  .math-game .math-game-friend-row { flex: 1 1 auto; min-height: 0; }
  .math-game .math-game-friend-card { flex-basis: 100px; min-width: 100px; min-height: 112px; }
  .math-game .math-game-friend-picker > .math-game-button { width: 100%; min-height: 58px; }
  .math-game .math-game-collection,
  .math-game .math-game-review-book { flex: 0 0 104px; padding: 8px 10px; border-radius: 16px; }
  .math-game .math-game-collection-grid,
  .math-game .math-game-review-grid { min-height: 54px; }
  .math-game .math-game-collection-slot,
  .math-game .math-game-review-station { min-height: 54px; min-width: 115px; }
  .math-game .math-game-cottage-footer { min-height: 32px; }

  .math-game.math-game-fork .math-game-fork-card,
  .math-game.math-game-result .math-game-result-card,
  .math-game.math-game-ending .math-game-ending-card,
  .math-game.math-game-home .math-game-home-card { width: calc(100% - 24px); margin-top: 88px; padding: 14px; }
  .math-game .math-game-route-choices { grid-template-columns: minmax(0, 1fr); }
  .math-game .math-game-result-actions,
  .math-game .math-game-ending-actions,
  .math-game .math-game-home-actions { width: calc(100% - 24px); }
  .math-game .math-game-home .home-collection { width: calc(100% - 24px); margin-top: 10px; }
}

@media (max-width: 390px) {
  .math-game .math-game-invite-card { grid-template-columns: 37% 1fr; }
  .math-game .math-game-invite-copy h2 { font-size: 22px; }
  .math-game .math-game-friend-card { flex-basis: 94px; min-width: 94px; }
  .math-game .math-game-section-title h2 { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .math-game *,
  .math-game *::before,
  .math-game *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

/* Final composition correction: let the actors and materials lead the page. */
.math-game .math-game-work-area { padding-top: 84px; }
.math-game .math-game-quest,
.math-game .math-game-work-card,
.math-game .math-game-invite-card,
.math-game .math-game-friend-picker,
.math-game .math-game-collection,
.math-game .math-game-review-book {
  background: #fff8e9;
}
.math-game .math-game-invite-card { min-height: 0; }
.math-game .math-game-invite-characters {
  height: 100%;
  min-height: 0;
  isolation: isolate;
  background: #e1eedf;
}
.math-game .math-game-invite-characters > .math-game-dog,
.math-game .math-game-invite-characters > .math-game-friend-large {
  z-index: 8;
  visibility: visible;
  opacity: 1;
}
.math-game .math-game-invite-characters > .math-game-dog {
  width: 120px;
  height: 166px;
  left: 10%;
  bottom: -10px;
}
.math-game .math-game-invite-characters > .math-game-friend-large {
  right: 10%;
  bottom: 7px;
  width: 116px;
}
.math-game .math-game-invite-characters > .math-game-friend-large svg {
  width: 92px;
  height: 116px;
}
.math-game.math-game-cottage .math-game-cottage-content {
  grid-template-rows: minmax(190px, 1.2fr) minmax(165px, 1fr) minmax(100px, .7fr) 36px;
  align-content: stretch;
}
.math-game .math-game-material-bank {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px 12px;
}
.math-game .math-game-material-bank > span { flex: 0 0 100%; }
.math-game .math-game-material-source {
  flex: 0 1 230px;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 6px;
  min-height: 92px;
  padding: 7px 10px;
  text-align: center;
}
.math-game .math-game-material-source svg {
  width: 84px;
  height: 68px;
}
.math-game .math-game-material-source b { line-height: 1.35; }
.math-game .math-game-place-value > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.math-game .math-game-place-value h3 { width: 100%; text-align: center; }
.math-game .math-game-token-row,
.math-game .math-game-chip-row { justify-content: center; }
.math-game .math-game-submit-bar .math-game-button { min-height: 64px; }

@media (min-width: 801px) and (max-height: 820px) {
  .math-game .math-game-work-area { padding-top: 72px; }
  .math-game.math-game-cottage .math-game-cottage-content {
    grid-template-rows: minmax(160px, 1.15fr) minmax(140px, 1fr) minmax(82px, .6fr) 30px;
  }
  .math-game .math-game-invite-characters > .math-game-dog { width: 104px; height: 146px; }
  .math-game .math-game-invite-characters > .math-game-friend-large { width: 100px; }
  .math-game .math-game-invite-characters > .math-game-friend-large svg { width: 80px; height: 102px; }
}

@media (max-width: 800px) {
  .math-game .math-game-work-area { padding-top: 98px; }
  .math-game .math-game-invite-characters > .math-game-dog { width: 78px; height: 108px; left: 5%; }
  .math-game .math-game-invite-characters > .math-game-friend-large { right: 3%; width: 78px; }
  .math-game .math-game-invite-characters > .math-game-friend-large svg { width: 62px; height: 78px; }
  .math-game .math-game-material-source {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 104px;
  }
  .math-game .math-game-material-source svg { width: 76px; height: 62px; }
  .math-game .math-game-submit-bar .math-game-button { min-height: 64px; }
}

/* Math owns the viewport only while its root is mounted.  The normal shell
 * automatically returns when .math-game is removed. */
body:has(.math-game) {
  overflow: hidden;
  background: #e9efdf;
}
body:has(.math-game) > .site-header,
body:has(.math-game) > .dock,
body:has(.math-game) > #storage-warning,
body:has(.math-game) > #install-banner,
body:has(.math-game) > #immersive-banner {
  display: none !important;
}
body:has(.math-game) > #rotate-guide {
  display: none !important;
}
#app:has(.math-game) {
  width: 100%;
  max-width: none !important;
  min-height: 100dvh;
  height: 100dvh;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}

/* New story markup: the invitation belongs to the painted stage.  Keep the
 * lower controls compact so they cannot cover the actors or intercept the
 * stage invitation. */
.math-game.math-game-cottage > .math-game-scene {
  z-index: 0;
  pointer-events: none;
}
.math-game.math-game-cottage > .math-game-scene > .math-game-scene-caption {
  top: 112px;
  left: 30px;
}
.math-game.math-game-cottage > .math-game-scene > .math-game-home-character {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.math-game.math-game-cottage .math-game-home-character > .math-game-dog {
  position: absolute;
  left: 42%;
  bottom: 12%;
  z-index: 2;
  width: 134px;
  height: 184px;
}
.math-game.math-game-cottage .math-game-home-character > svg {
  position: absolute;
  right: 17%;
  bottom: 9%;
  z-index: 2;
  width: 150px;
  height: 190px;
  max-width: none;
}
.math-game.math-game-cottage .math-game-home-character > strong {
  position: absolute;
  right: 22%;
  bottom: 5%;
  z-index: 3;
  color: var(--math-ink);
  font-size: 14px;
  text-shadow: 0 1px #fff8e9;
}
.math-game.math-game-cottage > .math-game-scene > .math-game-home-dialogue {
  position: absolute;
  right: 11%;
  bottom: 46%;
  z-index: 8;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: min(380px, 42vw);
  padding: 10px 13px 10px 15px;
  border: 1px solid rgba(36,79,72,.18);
  border-radius: 18px 18px 5px 18px;
  background: rgba(255,249,232,.95);
  color: var(--math-ink);
  box-shadow: 0 5px 0 rgba(36,79,72,.12);
  font-weight: 800;
  pointer-events: auto;
}
.math-game.math-game-cottage .math-game-home-dialogue > span {
  max-width: 210px;
  line-height: 1.4;
}
.math-game.math-game-cottage .math-game-home-dialogue .math-game-button {
  flex: 0 0 auto;
  min-height: 64px;
  padding-inline: 17px;
  white-space: nowrap;
  pointer-events: auto;
}
.math-game.math-game-cottage .math-game-cottage-content {
  z-index: 3;
  pointer-events: none;
  grid-template-columns: minmax(0, 1.32fr) minmax(270px, .72fr);
  grid-template-rows: minmax(0, 1fr) 82px 32px;
  padding: 300px 30px 12px;
  gap: 9px 14px;
}
.math-game.math-game-cottage .math-game-cottage-content > * { pointer-events: auto; }
.math-game.math-game-cottage .math-game-friend-picker {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  height: 170px;
  padding: 9px 13px 8px;
  border: 1px solid rgba(36,79,72,.16);
  border-radius: 20px;
  background: rgba(255,248,233,.94);
  box-shadow: var(--math-shadow);
}
.math-game.math-game-cottage .math-game-friend-picker .math-game-friend-card {
  min-height: 102px;
}
.math-game.math-game-cottage .math-game-collection {
  grid-column: 1;
  grid-row: 2;
  align-self: stretch;
  padding: 7px 12px;
  border: 1px solid rgba(36,79,72,.14);
  border-radius: 17px;
  background: rgba(255,248,233,.94);
  box-shadow: var(--math-shadow);
}
.math-game.math-game-cottage .math-game-collection .math-game-section-title { margin-bottom: 4px; }
.math-game.math-game-cottage .math-game-collection-grid { min-height: 48px; }
.math-game.math-game-cottage .math-game-collection-slot { min-height: 48px; min-width: 116px; padding: 5px 8px; }
.math-game.math-game-cottage .math-game-collection-slot svg { width: 42px; height: 36px; }
.math-game.math-game-cottage .math-game-review-book {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: end;
  max-height: 261px;
  padding: 9px 12px;
  border: 1px solid rgba(36,79,72,.14);
  border-radius: 18px;
  background: rgba(255,248,233,.94);
  box-shadow: var(--math-shadow);
}
.math-game.math-game-cottage .math-game-cottage-footer {
  grid-column: 1 / -1;
  grid-row: 3;
  pointer-events: auto;
}
.math-game.math-game-cottage .math-game-keepsake-fixed,
.math-game.math-game-home .math-game-keepsake-fixed {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 116px;
  min-height: 48px;
  padding: 5px 8px;
  border: 2px dashed rgba(117,150,117,.38);
  border-radius: 14px;
  background: rgba(239,245,231,.72);
  color: var(--math-ink-soft);
  font-size: 12px;
}
.math-game.math-game-cottage .math-game-keepsake-fixed.filled,
.math-game.math-game-home .math-game-keepsake-fixed.filled {
  border-style: solid;
  border-color: rgba(217,126,95,.42);
  background: #fff0d8;
  color: var(--math-ink);
}
.math-game .math-game-keepsake-fixed > span { display: grid; place-items: center; flex: 0 0 auto; }
.math-game .math-game-keepsake-fixed svg { width: 42px; height: 36px; }
.math-game .math-game-keepsake-fixed b { line-height: 1.25; }
.math-game.math-game-cottage .math-game-previous-result {
  margin: 4px 0 0;
  color: var(--math-ink-soft);
  font-size: 11px;
}

/* Returned pages use the same physical stage but keep the keepsake decision
 * and story line legible above it. */
.math-game.math-game-home .math-game-home-card,
.math-game.math-game-ending .math-game-ending-card {
  width: min(760px, calc(100% - 68px));
  min-height: 148px;
  margin-top: 330px;
  padding: 17px 20px;
  background: rgba(255,248,233,.96);
}
.math-game.math-game-home .math-game-home-friend,
.math-game.math-game-ending .math-game-ending-friend { min-width: 118px; }
.math-game.math-game-home .math-game-keepsake-choice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 9px;
}
.math-game.math-game-home .math-game-keepsake-choice p { flex: 0 0 100%; margin: 0; }
.math-game.math-game-home .math-game-keepsake-choice .math-game-button { min-height: 56px; }
.math-game.math-game-home .home-collection {
  width: min(760px, calc(100% - 68px));
  margin: 10px auto 0;
  padding: 9px 14px;
  background: rgba(255,248,233,.96);
}
.math-game.math-game-home .home-collection .math-game-collection-grid { min-height: 64px; }
.math-game.math-game-home .home-collection .math-game-collection-slot { min-height: 58px; }
.math-game.math-game-home .math-game-collection-grid { display: flex; gap: 9px; overflow-x: auto; }
.math-game.math-game-home .math-game-character-line {
  min-height: 44px;
  margin-top: 7px;
  border-top: 1px solid rgba(36,79,72,.14);
  color: var(--math-ink-soft);
}
.math-game.math-game-home .math-game-home-actions,
.math-game.math-game-ending .math-game-ending-actions { position: relative; z-index: 6; }

@media (min-width: 801px) and (max-height: 820px) {
  .math-game.math-game-cottage .math-game-home-character > .math-game-dog { width: 116px; height: 160px; }
  .math-game.math-game-cottage .math-game-home-character > svg { width: 130px; height: 166px; }
  .math-game.math-game-cottage > .math-game-scene > .math-game-home-dialogue { bottom: 43%; }
  .math-game.math-game-cottage > .math-game-scene > .math-game-scene-caption { top: 88px; }
  .math-game.math-game-cottage .math-game-cottage-content { padding-top: 255px; grid-template-rows: minmax(0, 1fr) 72px 28px; }
  .math-game.math-game-cottage .math-game-friend-picker { height: 150px; }
  .math-game.math-game-cottage .math-game-review-book { max-height: 231px; }
  .math-game.math-game-home .math-game-home-card,
  .math-game.math-game-ending .math-game-ending-card { margin-top: 270px; }
}

@media (max-width: 800px) {
  .math-game.math-game-cottage .math-game-home-character > .math-game-dog { left: 38%; width: 82px; height: 114px; bottom: 12%; }
  .math-game.math-game-cottage .math-game-home-character > svg { right: 8%; width: 94px; height: 120px; bottom: 9%; }
  .math-game.math-game-cottage .math-game-home-character > strong { right: 13%; bottom: 5%; font-size: 12px; }
  .math-game.math-game-cottage > .math-game-scene > .math-game-home-dialogue {
    right: 7%;
    bottom: 39%;
    max-width: 78vw;
    padding: 8px 10px;
    font-size: 12px;
  }
  .math-game.math-game-cottage > .math-game-scene > .math-game-scene-caption { top: 90px; left: 16px; }
  .math-game.math-game-cottage .math-game-home-dialogue > span { max-width: 135px; }
  .math-game.math-game-cottage .math-game-home-dialogue .math-game-button { min-height: 56px; padding-inline: 11px; font-size: 12px; }
  .math-game.math-game-cottage .math-game-cottage-content {
    pointer-events: none;
    padding: 360px 12px 18px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 188px 94px 94px 32px;
  }
  .math-game.math-game-cottage .math-game-friend-picker { grid-column: 1; grid-row: 1; height: 188px; }
  .math-game.math-game-cottage .math-game-collection { grid-column: 1; grid-row: 2; }
  .math-game.math-game-cottage .math-game-review-book { grid-column: 1; grid-row: 3; max-height: none; }
  .math-game.math-game-cottage .math-game-cottage-footer { grid-column: 1; grid-row: 4; }
  .math-game.math-game-home .math-game-home-card,
  .math-game.math-game-ending .math-game-ending-card { width: calc(100% - 24px); margin-top: 280px; padding: 14px; }
  .math-game.math-game-home .home-collection { width: calc(100% - 24px); }
}

/* Pointer feedback is part of the material, not a browser drag ghost. */
.math-game [data-drag-kind] { touch-action: none; }
.math-game .math-game-drag-ghost {
  position: fixed !important;
  z-index: 80;
  display: grid;
  place-items: center;
  margin: 0;
  border: 2px solid rgba(36,79,72,.28);
  border-radius: 17px;
  background: rgba(255,248,233,.94);
  box-shadow: 0 12px 24px rgba(36,79,72,.22);
  opacity: .94;
  pointer-events: none !important;
  transform: translate3d(-50%, -50%, 0) rotate(-2deg) scale(1.04);
  transform-origin: center;
}
.math-game .math-game-drag-ghost svg {
  width: 84% !important;
  height: 78% !important;
  max-width: 100%;
}
.math-game .math-game-hint-focus {
  position: relative;
  z-index: 7;
  outline: 4px solid rgba(217,126,95,.82);
  outline-offset: 4px;
  box-shadow: 0 0 0 8px rgba(237,195,111,.25), 0 8px 18px rgba(64,92,76,.16);
  animation: math-game-hint-pulse 1.1s ease-in-out 2;
}
@keyframes math-game-hint-pulse {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.18) brightness(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .math-game .math-game-hint-focus { animation: none; }
}

/* Cottage helpers stay as small anchors along the lower edge of the stage. */
.math-game.math-game-cottage .math-game-cottage-content {
  grid-template-rows: minmax(0, 1fr) 72px 30px;
  overflow: visible;
}
.math-game.math-game-cottage .math-game-friend-picker {
  justify-self: start;
  width: min(350px, 100%);
  height: 112px;
  padding: 7px 10px 6px;
  border-radius: 16px;
}
.math-game.math-game-cottage .math-game-friend-picker .math-game-section-title {
  gap: 6px;
  margin-bottom: 2px;
}
.math-game.math-game-cottage .math-game-friend-picker .math-game-section-title h2 { font-size: 16px; }
.math-game.math-game-cottage .math-game-friend-picker .math-game-section-title span { font-size: 10px; }
.math-game.math-game-cottage .math-game-friend-row {
  height: 76px;
  gap: 6px;
  padding: 1px 0 3px;
}
.math-game.math-game-cottage .math-game-friend-card {
  flex: 0 0 88px;
  min-width: 88px;
  min-height: 70px;
  padding: 4px 5px;
  border-radius: 12px;
  gap: 1px;
}
.math-game.math-game-cottage .math-game-friend-card svg { width: 35px; height: 43px; }
.math-game.math-game-cottage .math-game-friend-card span { font-size: 12px; }
.math-game.math-game-cottage .math-game-friend-card small { font-size: 9px; }
.math-game.math-game-cottage .math-game-friend-pager {
  position: absolute;
  right: 8px;
  top: 7px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
}
.math-game.math-game-cottage .math-game-friend-pager .math-game-text-button {
  min-height: 30px;
  padding: 2px 6px;
}
.math-game.math-game-cottage .math-game-collection {
  justify-self: start;
  width: min(350px, 100%);
  height: 72px;
  padding: 6px 9px;
  border-radius: 15px;
}
.math-game.math-game-cottage .math-game-collection .math-game-section-title h2 { font-size: 14px; }
.math-game.math-game-cottage .math-game-collection .math-game-section-title span { font-size: 10px; }
.math-game.math-game-cottage .math-game-collection-grid { min-height: 44px; gap: 6px; }
.math-game.math-game-cottage .math-game-keepsake-fixed {
  min-width: 0;
  width: 150px;
  min-height: 44px;
  padding: 4px 6px;
  border-radius: 11px;
  font-size: 10px;
}
.math-game.math-game-cottage .math-game-keepsake-fixed svg { width: 34px; height: 30px; }
.math-game.math-game-cottage .math-game-review-book {
  justify-self: end;
  align-self: end;
  width: min(340px, 100%);
  max-height: 58px;
  padding: 6px 9px;
  border-radius: 15px;
}
.math-game.math-game-cottage .math-game-review-book[open] {
  max-height: 220px;
  overflow: auto;
}
.math-game.math-game-cottage .math-game-review-book summary { min-height: 42px; cursor: pointer; }
.math-game.math-game-cottage .math-game-review-book summary .math-game-section-title { gap: 5px; }
.math-game.math-game-cottage .math-game-review-book summary h2 { font-size: 14px; }
.math-game.math-game-cottage .math-game-review-book summary span { font-size: 10px; }
.math-game.math-game-cottage .math-game-review-grid { min-height: 40px; gap: 6px; }
.math-game.math-game-cottage .math-game-review-station { min-width: 108px; min-height: 44px; padding: 5px 7px; }

/* A replay is a real picture-book card, independent of the compact slot row. */
.math-game .math-game-keepsake-replay {
  position: fixed;
  z-index: 18;
  left: 50%;
  bottom: 18px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: min(470px, calc(100vw - 36px));
  min-height: 126px;
  padding: 13px 18px 13px 13px;
  border: 2px solid rgba(217,126,95,.45);
  border-radius: 20px;
  background: #fff8e9;
  box-shadow: 0 16px 36px rgba(36,79,72,.28);
  transform: translateX(-50%);
}
.math-game .math-game-keepsake-replay-art {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
  min-height: 94px;
}
.math-game .math-game-keepsake-replay-art svg:first-child { width: 82px; height: 70px; }
.math-game .math-game-keepsake-replay-art svg:last-child { width: 58px; height: 78px; }
.math-game .math-game-keepsake-replay h3 { margin: 0 28px 5px 0; font-size: 16px; }
.math-game .math-game-keepsake-replay p { margin: 0; color: var(--math-ink-soft); line-height: 1.5; font-size: 13px; }
.math-game .math-game-keepsake-replay > button,
.math-game .math-game-keepsake-replay .math-game-keepsake-replay-close {
  position: absolute;
  top: 8px;
  right: 9px;
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 50%;
  background: #f4e4c3;
  color: var(--math-ink);
}

/* Keep the chapter-12 gathering legible instead of eight full-size SVGs. */
.math-game .math-game-ending-gathering {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(239,245,231,.86);
}
.math-game .math-game-ending-friends {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  width: min(330px, 100%);
  min-height: 58px;
  align-items: end;
}
.math-game .math-game-ending-friends svg { width: 52px; height: 62px; max-width: 100%; }
.math-game .math-game-ending-gathering p { margin: 5px 0 0; color: var(--math-ink-soft); font-size: 12px; line-height: 1.35; }

/* Materials: show the ten frame and road as actual cells, with stable touch
 * geometry even when the stage is squeezed on iPad. */
.math-game .math-game-road {
  display: block;
  height: 96px;
  padding: 8px;
  border-radius: 18px;
  background: #e7d3a7;
}
.math-game .math-game-road-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  height: 100%;
}
.math-game .math-game-road-cell {
  display: block;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(117,150,117,.45);
  border-radius: 4px;
  background: rgba(255,248,233,.85);
}
.math-game .math-game-road-cell.filled { background: #d39b62; border-color: #b67a50; }
.math-game .math-game-road-fill {
  position: absolute;
  inset: 8px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 3px;
  background: transparent;
  opacity: .18;
  pointer-events: none;
}
.math-game .math-game-road-fill svg { width: 100%; height: 100%; min-width: 0; object-fit: contain; }
.math-game .math-game-loose-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  max-width: 360px;
  margin: 6px auto 0;
}
.math-game .math-game-loose-one {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 54px;
  aspect-ratio: 1;
  padding: 4px;
  border: 1px solid rgba(36,79,72,.17);
  border-radius: 9px;
  background: #fff8e9;
}
.math-game .math-game-loose-one.selected { background: #ffe2c2; border-color: var(--math-coral); box-shadow: 0 0 0 2px rgba(217,126,95,.25); }
.math-game .math-game-loose-one svg { width: 80%; height: 80%; }
.math-game .math-game-ten-frame {
  display: grid;
  gap: 5px;
  width: min(360px, 100%);
  margin: 8px auto 0;
  padding: 8px;
  border: 2px solid rgba(117,150,117,.42);
  border-radius: 12px;
  background: #e7efdf;
}
.math-game .math-game-ten-frame-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}
.math-game .math-game-ten-frame-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 42px;
  aspect-ratio: 1;
  border: 1px solid rgba(117,150,117,.38);
  border-radius: 7px;
  background: #fff8e9;
}
.math-game .math-game-ten-frame-cell.selected { background: #f4d596; border-color: #c9855e; }
.math-game .math-game-ten-frame-cell svg { width: 78%; height: 78%; }

@media (min-width: 801px) and (max-height: 820px) {
  .math-game.math-game-cottage .math-game-friend-picker { height: 100px; }
  .math-game.math-game-cottage .math-game-friend-row { height: 66px; }
  .math-game.math-game-cottage .math-game-friend-card { min-height: 62px; }
  .math-game.math-game-cottage .math-game-friend-card svg { width: 31px; height: 37px; }
  .math-game.math-game-cottage .math-game-collection { height: 64px; }
  .math-game.math-game-cottage .math-game-keepsake-fixed { min-height: 38px; }
  .math-game.math-game-cottage .math-game-review-book { max-height: 50px; }
}
@media (max-width: 800px) {
  .math-game.math-game-cottage .math-game-cottage-content { grid-template-rows: 130px 72px 72px 30px; }
  .math-game.math-game-cottage .math-game-friend-picker { width: min(350px, 100%); height: 130px; }
  .math-game.math-game-cottage .math-game-friend-row { height: 82px; }
  .math-game.math-game-cottage .math-game-friend-card { min-height: 72px; }
  .math-game.math-game-cottage .math-game-review-book { width: min(350px, 100%); max-height: 54px; }
  .math-game .math-game-keepsake-replay { bottom: 10px; width: calc(100vw - 24px); grid-template-columns: 100px minmax(0, 1fr); }
  .math-game .math-game-keepsake-replay-art svg:first-child { width: 62px; height: 54px; }
  .math-game .math-game-keepsake-replay-art svg:last-child { width: 46px; height: 62px; }
  .math-game .math-game-road { height: 88px; }
  .math-game .math-game-loose-grid,
  .math-game .math-game-ten-frame { max-width: 300px; }
  .math-game .math-game-loose-one { min-height: 48px; }
  .math-game .math-game-ten-frame-cell { min-height: 36px; }
}

/* Final cottage pass: keep the actors and invitation clear of utility zones. */
.math-game.math-game-cottage .math-game-friend-picker {
  height: auto;
  min-height: 116px;
  overflow: visible;
  align-self: end;
}
.math-game.math-game-cottage .math-game-friend-row {
  height: auto;
  min-height: 76px;
  max-height: none;
  overflow: visible;
}
.math-game.math-game-cottage .math-game-friend-card { min-height: 76px; }
.math-game.math-game-cottage .math-game-review-book {
  position: fixed;
  top: 116px;
  right: 30px;
  z-index: 5;
  width: min(340px, calc(100% - 60px));
  max-height: 54px;
  margin: 0;
  align-self: auto;
}
.math-game.math-game-cottage .math-game-review-book[open] { max-height: 220px; }
.math-game.math-game-cottage > .math-game-scene > .math-game-home-dialogue {
  flex-wrap: wrap;
  max-width: min(500px, 48vw);
}
.math-game.math-game-cottage .math-game-home-dialogue > span {
  flex: 1 1 100%;
  max-width: none;
  line-height: 1.45;
}
.math-game.math-game-cottage .math-game-home-dialogue .math-game-button {
  min-height: 56px;
  font-size: 13px;
}
.math-game.math-game-cottage .math-game-home-dialogue .math-game-button.secondary {
  background: #f4e4c3;
}

@media (min-width: 801px) and (max-height: 820px) {
  .math-game.math-game-cottage .math-game-friend-picker { min-height: 108px; }
  .math-game.math-game-cottage .math-game-friend-row { min-height: 70px; }
  .math-game.math-game-cottage .math-game-review-book { top: 86px; right: 24px; }
  .math-game.math-game-cottage > .math-game-scene > .math-game-home-dialogue { max-width: min(460px, 48vw); }
}
@media (max-width: 800px) {
  .math-game.math-game-cottage .math-game-friend-picker { min-height: 122px; }
  .math-game.math-game-cottage .math-game-friend-row { min-height: 80px; }
  .math-game.math-game-cottage .math-game-review-book {
    position: fixed;
    top: 98px;
    right: 12px;
    width: calc(100% - 24px);
  }
  .math-game.math-game-cottage > .math-game-scene > .math-game-home-dialogue {
    max-width: 86vw;
    bottom: 37%;
  }
}
/* Living cottage: touchable objects and a small, concrete ongoing project. */
.math-game .math-dog-hat{position:absolute;width:68%;height:44%;left:16%;top:-5%;z-index:5;pointer-events:none}.math-game .math-dog-apron{position:absolute;width:45%;height:40%;left:28%;top:53%;z-index:4;pointer-events:none}.math-game .math-dog-badge{position:absolute;left:52%;top:64%;color:#c59c40;z-index:6}.math-game .math-game-dog.growth-1{scale:1.04}.math-game .math-game-dog.growth-2{scale:1.09}.math-game .math-game-dog.growth-3{scale:1.14}
.math-game .math-flow-voice{position:absolute;top:66px;right:24px;z-index:9;display:flex;align-items:center;gap:8px;max-width:300px}.math-game .math-flow-voice span{font-size:11px;max-width:120px}.math-game-cottage .math-flow-voice{top:48px}.math-game .math-world{position:fixed;inset:6vh 5vw;z-index:30;background:#fcf3dc;border:3px solid #a4b391;border-radius:28px;padding:22px;overflow:auto;box-shadow:0 20px 90px #34493466}.math-game .math-world header{display:flex;align-items:center;justify-content:space-between;gap:16px;position:sticky;top:-22px;background:#fcf3dc;z-index:2;padding:12px 0}.math-game .math-world h2{font-size:22px;margin:0}.math-game .math-world header button,.math-game .math-world button{font:inherit;color:var(--ink)}.math-game .math-world header button{border:1px solid #bec7a7;background:#fff8e7;border-radius:20px;padding:12px}.math-game .math-world-yard{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:#e6ead4;border-radius:22px;padding:16px;gap:14px}.math-game .math-world-facility{border:0;background:transparent;min-height:150px;display:flex;flex-direction:column;align-items:center}.math-game .math-world-facility svg{width:100%;max-height:145px;filter:drop-shadow(0 7px 1px #82967522)}.math-game .math-world-facility span{font-size:14px;background:#fff7e4;border-radius:14px;padding:5px 10px}.math-game .math-world-response{min-height:30px;text-align:center;font-weight:bold}.math-game .math-world-empty{grid-column:1/-1;text-align:center}.math-game .math-world-empty svg{height:140px}.math-game .math-world-visitors{display:flex;gap:16px;flex-wrap:wrap}.math-game .math-visitor{background:#f3e5c7;border:0;border-radius:30px;padding:12px;position:relative;width:140px}.math-game .math-visitor svg{height:90px;width:70px}.math-game .math-visitor.has-corner svg+svg{width:65px;height:60px}.math-game .math-visitor span{display:block;font-size:12px}.math-game .math-memory-book,.math-game .math-gifts{margin-top:18px;border-top:1px solid #d0d4b8;padding-top:12px}.math-game summary{cursor:pointer}.math-game .math-memory-pages,.math-game .math-gifts>div{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding-top:14px}.math-game .math-memory-pages button,.math-game .math-gifts button{border:1px solid #d0d4b8;border-radius:8px 20px 20px 8px;background:#fff9e9;padding:12px;display:flex;flex-direction:column;gap:7px;align-items:center}.math-game .math-memory-pages svg,.math-game .math-gifts svg{width:100px;height:80px}.math-game .math-memory-pages span,.math-game .math-memory-pages small,.math-game .math-gifts span{font-size:12px}.math-game .math-collection-complete{display:flex;align-items:center;gap:14px}.math-game .math-collection-complete svg{height:90px;width:70px}
.math-game .math-project,.math-game .math-project-choice{background:#f9eed2;border:1px solid #cbd1af;border-radius:18px;padding:12px;max-width:460px;margin:12px auto;font-size:13px}.math-game-cottage .math-project,.math-game-cottage .math-project-choice{position:absolute;right:24px;bottom:105px;width:290px;z-index:5;margin:0}.math-game .math-project-choice{display:flex;align-items:center;gap:7px}.math-game .math-project-choice>span{max-width:90px}.math-game .math-project-choice button{border:0;background:#efe4c4;border-radius:14px;padding:8px;font-size:12px;color:var(--ink)}.math-game .math-project-choice svg{display:block;width:64px;height:50px}.math-game .math-project-stages{display:flex;gap:7px;font-size:11px;margin:8px 0}.math-game .math-project-stages span{opacity:.4}.math-game .math-project-stages .done{opacity:1;color:#52734b;font-weight:bold}.math-game .math-project-stages span+span:before{content:'›';margin-right:7px}.math-game .math-project-pieces{display:flex;justify-content:space-around}.math-game .math-project-pieces>span{display:flex;align-items:center;flex-direction:column;opacity:.35}.math-game .math-project-pieces>span.ready{opacity:1}.math-game .math-project-pieces svg{width:50px;height:40px}.math-game .math-project-pieces small{font-size:11px}.math-game .math-project .math-game-button{margin-top:8px;font-size:12px;min-height:44px;padding:8px 12px}
.math-game .math-delivered-batches{display:flex;gap:10px;max-width:840px;margin:10px auto;justify-content:center}.math-game .math-delivered-batches>div{flex:1;max-width:145px;text-align:center;background:#f5e8c8;border-radius:12px;padding:8px}.math-game .math-delivered-batches svg{display:block;margin:auto;width:65px;height:46px}.math-game .math-delivered-batches span,.math-game .math-delivered-batches strong,.math-game .math-delivered-batches small{display:block;font-size:12px}.math-game .math-delivered-batches small{font-size:10px}.math-game .math-performance{position:relative;width:min(540px,90%);height:150px;margin:6px auto;background:radial-gradient(ellipse at bottom,#d9e4c7,transparent 70%);overflow:hidden}.math-game .math-performance>div{position:absolute;bottom:24px;width:100px;height:105px}.math-game .performance-host{left:8%;animation:math-host-use 2.6s ease both}.math-game .performance-guest{right:8%;animation:math-guest-arrive 2.6s ease both}.math-game .performance-result{left:35%;width:150px!important;animation:math-result-use 2.6s ease both}.math-game .performance-result svg{position:absolute;width:130px;height:100px}.math-game .performance-result svg+svg{width:50px;height:40px;right:0;bottom:12px;animation:math-share 2.6s ease both}.math-game .math-performance>div>svg{max-height:100%}.math-game .math-performance p{position:absolute;bottom:0;left:0;right:0;text-align:center;margin:0;font-size:12px}.math-game .math-performance>button{position:absolute;right:0;top:0;border:0;background:#fff6df;border-radius:15px;padding:8px;font-size:11px;color:#587250}.math-game .math-performance.finished *{animation:none!important}.math-game .theme-mail .performance-result,.math-game .theme-cargo .performance-result{animation:math-cart-go 3s ease both}.math-game .theme-shell-window .facility-swing{animation:math-swing .6s ease 4}.math-game .theme-light-path .facility-lights{animation:math-light 2s ease both}.math-game .theme-album .facility-pages{animation:math-page 1s ease 2}.math-game .cooperate-0{animation:math-host-use 2s ease both}.math-game .cooperate-1{animation:math-guest-arrive 2s ease both}.math-game .math-game-companions>div>svg+svg{position:absolute;width:35px;height:30px;bottom:22px}.math-game .math-world-facility.ringing .facility-swing{animation:math-swing .5s ease 4}
@keyframes math-host-use{from{transform:translateX(-30px)}to{transform:translateX(12px)}}@keyframes math-guest-arrive{from{transform:translateX(90px);opacity:0}to{transform:translateX(-12px);opacity:1}}@keyframes math-result-use{from{transform:scale(.75);opacity:.3}to{transform:scale(1);opacity:1}}@keyframes math-share{0%,35%{transform:translateX(-70px)}100%{transform:translateX(80px)}}@keyframes math-cart-go{0%{transform:translateX(-70px)}100%{transform:translateX(65px)}}@keyframes math-swing{0%,100%{rotate:-9deg}50%{rotate:9deg}}@keyframes math-light{from{opacity:.1}to{opacity:1}}@keyframes math-page{50%{transform:skewY(-12deg)}}
@media(min-width:801px){.math-game.math-game-result .math-game-scene,.math-game.math-game-ending .math-game-scene{height:150px}.math-game.math-game-result .math-game-result-card{margin-top:0;padding:12px 20px}.math-game.math-game-result .math-game-result-character svg{height:72px}.math-game.math-game-result .math-game-result-actions{margin-top:6px}.math-game.math-game-result .math-performance{height:125px}.math-game.math-game-result .math-performance>div{height:85px}.math-game.math-game-ending .math-performance{height:125px}}
@media(max-width:800px){.math-game .math-world{inset:12px;padding:14px}.math-game .math-world header{top:-14px}.math-game .math-world h2{font-size:17px}.math-game .math-world-yard,.math-game .math-memory-pages,.math-game .math-gifts>div{grid-template-columns:repeat(2,minmax(0,1fr))}.math-game .math-world-facility{min-height:120px}.math-game .math-world-facility svg{max-height:110px}.math-game-cottage .math-project,.math-game-cottage .math-project-choice{position:relative;right:auto;bottom:auto;width:auto;max-width:none;grid-column:1/-1;grid-row:auto}.math-game.math-game-cottage .math-game-cottage-content{height:auto;display:flex;flex-direction:column;padding-top:340px;gap:12px;min-height:850px}.math-game.math-game-cottage .math-game-friend-picker,.math-game.math-game-cottage .math-game-collection{align-self:stretch;width:auto;height:auto}.math-game .math-flow-voice{top:55px;right:12px;max-width:200px}.math-game .math-flow-voice span{display:none}.math-game .math-delivered-batches{flex-wrap:wrap;padding:0 10px}.math-game .math-delivered-batches>div{flex:1 1 90px}.math-game .math-performance{height:140px}}
@media(prefers-reduced-motion:reduce){.math-game .math-performance *,.math-game .math-world-facility *,.math-game .math-game-companions *{animation:none!important}}
.math-game .math-tutor{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);width:min(640px,calc(100% - 32px));box-sizing:border-box;background:#fff4d6;border:2px solid #93aa7d;border-radius:24px;padding:14px 20px;z-index:24;box-shadow:0 12px 40px #43583b44}.math-game .math-tutor-guide{display:flex;align-items:center;gap:14px}.math-game .math-tutor-guide svg{width:52px;height:68px;flex-shrink:0}.math-game .math-tutor-guide p{font-size:16px;line-height:1.5;margin:0}.math-game .math-tutor>div:last-child{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap}.math-game .math-tutor .math-game-button{min-height:44px;font-size:13px}.math-game .math-tutor-sandbox{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:10px 0}.math-game .math-tutor-sandbox>span>svg{width:55px;height:45px}.math-game .sandbox-ones{display:grid;grid-template-columns:repeat(5,24px);gap:3px}.math-game .sandbox-ones svg{width:24px!important;height:24px!important}.math-game .math-tutor-sandbox p{font-size:13px}.math-game .math-route-preview{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:5px 0 12px}.math-game .math-route-preview>span{font-size:11px;opacity:.55}.math-game .math-route-preview>span.available{opacity:1}.math-game .math-route-preview button{display:flex;align-items:center;gap:4px;border:1px solid #c1cba9;background:#fff4d8;border-radius:16px;color:#56704d;padding:8px;font-size:12px}.math-game .math-route-preview svg{width:35px;height:30px}
/* One invitation, one place to act; utilities live outside the play scene. */
.math-game.math-game-cottage .math-game-topline{padding:14px 24px;gap:10px}.math-game.math-game-cottage .math-game-topline .math-game-text-button{background:#f9f1dcda;border-radius:18px;text-decoration:none;padding:9px 14px}.math-game.math-game-cottage .math-game-review-book{top:auto;bottom:24px;right:24px;max-height:48px;width:220px;padding:12px 16px}.math-game.math-game-cottage .math-game-review-book[open]{max-height:230px;overflow:auto}.math-game.math-game-cottage .math-game-cottage-content{padding:0;position:absolute;inset:0;height:100%;pointer-events:none;display:block}.math-game.math-game-cottage .math-game-friend-picker{position:absolute;bottom:28px;left:30px;min-height:0;height:auto;width:auto;max-width:300px;margin:0;padding:10px 14px;background:#f7edd5d9;border-radius:24px;box-shadow:none}.math-game.math-game-cottage .math-game-friend-picker .math-game-section-title{margin:0 0 4px}.math-game.math-game-cottage .math-game-friend-picker h2{font-size:12px}.math-game.math-game-cottage .math-game-friend-row{min-height:0;gap:8px;padding:2px;margin:0}.math-game.math-game-cottage .math-game-friend-card{min-width:58px;min-height:65px;border:0;padding:4px 7px;background:transparent;box-shadow:none;border-radius:20px}.math-game.math-game-cottage .math-game-friend-card.selected{background:#d7e1c4}.math-game.math-game-cottage .math-game-friend-card svg{width:38px;height:46px}.math-game.math-game-cottage .math-game-friend-card span{font-size:11px}.math-game.math-game-cottage .math-game-friend-picker select{max-width:160px;font-size:12px}.math-game.math-game-cottage>.math-game-scene>.math-game-home-dialogue{bottom:43%;right:9%;width:420px;max-width:45vw;padding:17px 20px;gap:8px;border-radius:26px 26px 26px 5px}.math-game .math-game-home-dialogue h2{font-size:23px;margin:0}.math-game .math-invite-places{display:flex;align-items:center;gap:9px;width:100%;font-size:12px}.math-game .math-invite-places button{display:flex;align-items:center;gap:4px;border:1px solid #d2d8b8;border-radius:12px;background:#f7ecd1;padding:5px 10px;color:#4e6c50;font-size:12px}.math-game .math-invite-places svg{width:43px;height:34px}.math-game .math-invite-actions{display:flex;gap:8px}.math-game .math-invite-project{font-size:12px}.math-game .math-game-home-dialogue small{font-size:11px;min-height:0}.math-game.math-game-cottage>.math-game-scene>.math-game-home-character{pointer-events:none}.math-game.math-game-cottage .math-project{bottom:115px;right:24px;max-height:220px;overflow:auto}.math-game .math-game-brief,.math-game .math-game-work-title,.math-game .math-game-quest .math-game-character-line{display:none}.math-game .math-game-quest{padding:14px 18px}.math-game .math-game-quest-title{width:100%}.math-game .math-game-quest-title h2{font-size:25px;line-height:1.25}.math-game .math-prior-use{display:flex;align-items:center;gap:8px;font-size:11px;padding:3px 12px;background:#e7eacb;border-radius:12px;margin-top:6px}.math-game .math-prior-use svg{height:36px;width:45px}.math-game .math-prior-use svg:last-child{animation:math-cart-go 2.5s ease both}
@media(max-width:800px){.math-game.math-game-cottage .math-game-cottage-content{position:relative;inset:auto;display:flex;flex-direction:column;height:auto;min-height:210px;padding:0 16px 24px;margin-top:570px;gap:12px}.math-game.math-game-cottage .math-game-friend-picker,.math-game.math-game-cottage .math-game-review-book,.math-game.math-game-cottage .math-project{position:relative;left:auto;right:auto;bottom:auto;top:auto;max-width:none;width:auto;align-self:stretch}.math-game.math-game-cottage>.math-game-scene>.math-game-home-dialogue{bottom:auto;top:100px;left:7%;right:7%;width:auto;max-width:none}.math-game.math-game-cottage .math-game-topline{padding:12px;gap:6px}.math-game.math-game-cottage .math-game-topline .math-game-text-button{padding:8px;font-size:11px}.math-game.math-game-cottage .math-game-home-character>.math-game-dog{bottom:22%}.math-game.math-game-cottage .math-game-home-character>svg{bottom:21%}.math-game.math-game-cottage .math-game-home-character>strong{bottom:18%}}
.math-game .sandbox-destination{border:2px dashed #b2bf93;border-radius:18px;background:#e5edcf;padding:14px;min-width:95px;font-size:13px}.math-game .sandbox-moving{animation:math-sandbox-move 1.6s ease both}.math-game .sandbox-path{display:flex;align-items:center;gap:24px}.math-game .sandbox-path i{display:grid;place-items:center;width:65px;height:55px;background:#dbdfbf;border-radius:22px;font-size:11px;font-style:normal}.math-game .sandbox-path svg{height:60px;width:45px}.math-game .sandbox-flip{animation:math-page 1s ease both}.math-game .math-tutor-sandbox>button{border:0;border-radius:16px;background:#dce8c8;color:#4a694d;padding:10px}.math-game .math-tutor-sandbox>p{flex-basis:100%;margin:0}@keyframes math-sandbox-move{from{transform:translateX(-12px)}to{transform:translateX(12px)}}
.math-game .math-gifts .gift-used svg{animation:math-result-use .7s ease both}.math-game .math-gifts small{color:#617853;font-size:11px}
.math-game .math-dog-scarf{position:absolute;top:42%;left:18%;width:65%;height:21%;z-index:4;pointer-events:none}
.math-game .math-world-fixed{display:flex;gap:12px;margin:8px 0 16px}.math-game .math-world-fixed .math-game-keepsake-fixed{display:flex;align-items:center;gap:8px;min-height:70px;padding:10px;background:#f2e5c5;border-radius:18px;border:1px solid #d1c8a6}.math-game .math-world-fixed svg{width:70px;height:60px}.math-game .math-world-fixed .empty{display:none}.math-game .math-world .math-game-keepsake-replay{z-index:35;bottom:10vh}
.math-game .math-discoveries-shelf{display:flex;flex-wrap:wrap;gap:10px;margin-top:15px}.math-game .math-discoveries-shelf button{display:flex;align-items:center;gap:8px;border:0;background:#e5eacb;border-radius:14px;padding:8px;font-size:12px}.math-game .math-discoveries-shelf svg{height:42px;width:48px}
.math-game .math-flow-voice.in-world{position:fixed;top:auto;bottom:8vh;right:8vw;z-index:36;background:#fcf3dc;border-radius:22px;padding:5px}
.math-game .math-tutor{bottom:76px;max-height:calc(100dvh - 170px);overflow:auto}.math-game.math-game-result>.math-game-scene,.math-game.math-game-ending>.math-game-scene{height:auto;min-height:0;inset:68px 0 0}.math-game.math-game-result>.math-game-result-card{margin-top:100px}.math-game.math-game-ending>.math-game-ending-card{margin-top:140px}.math-game.math-game-result>.math-performance,.math-game.math-game-ending>.math-performance{position:relative;z-index:3;background:#eef0d6c9;border-radius:30px;height:175px;max-width:660px;width:80%}.math-game.math-game-result>.math-performance>div,.math-game.math-game-ending>.math-performance>div{height:130px;width:125px}.math-game.math-game-result>.math-delivered-batches{position:relative;z-index:3}.math-game.math-game-ending .math-performance .performance-result svg{height:130px;width:160px}.math-game.math-game-ending .math-performance .performance-result svg+svg{height:50px;width:60px}.math-game.math-game-result .math-game-result-card p{margin:6px 0}.math-game.math-game-result .math-game-result-card h2{font-size:23px}
@media(min-width:801px) and (max-height:820px){.math-game.math-game-result>.math-game-result-card{margin-top:65px}.math-game.math-game-ending>.math-game-ending-card{margin-top:100px}.math-game.math-game-result>.math-performance{height:145px}.math-game.math-game-result>.math-performance>div{height:105px}.math-game .math-tutor{bottom:67px}}
@media(max-width:800px){.math-game .math-tutor{bottom:20px;max-height:75dvh}.math-game.math-game-ending>.math-game-ending-card{margin-top:120px}.math-game.math-game-result>.math-game-result-card{margin-top:90px}.math-game.math-game-result>.math-game-scene,.math-game.math-game-ending>.math-game-scene{height:100%;min-height:0}}
@media(min-width:801px){.math-game.math-game-cottage,.math-game.math-game-station,.math-game.math-game-fork,.math-game.math-game-result,.math-game.math-game-ending,.math-game.math-game-home,.math-game.math-game-paused{height:100dvh;min-height:100dvh}}
/* Shelf quantities are carried by large labels, never by timber length. */
.math-game .math-game-hand-shelf .math-game-chip-row{display:flex;justify-content:center;gap:24px;margin:2px 0 18px}.math-game .math-game-hand-shelf .math-game-token.kind-wood{width:146px;min-height:112px;position:relative;display:grid;grid-template-columns:58px 1fr;grid-template-rows:1fr 23px;align-items:center;justify-items:center;gap:0 6px;padding:10px 14px;border:2px solid #bda67c;border-radius:18px 22px 17px 21px;background:#f1dfb7;box-shadow:0 4px 0 #d4bd94;color:#36574a}.math-game .math-game-hand-shelf .math-game-token.kind-wood svg{position:static;width:58px;height:58px;grid-row:1/3;transform:none}.math-game .math-game-hand-shelf .math-game-token.kind-wood strong{font-size:38px;line-height:1;font-weight:800}.math-game .math-game-hand-shelf .math-game-token.kind-wood small{font-size:11px}.math-game .math-game-hand-shelf .math-game-token.kind-wood.selected{border-color:#54794f;background:#e3e8bf;box-shadow:0 4px 0 #92ad7e;transform:translateY(-2px)}.math-game .math-game-shelf-zones{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;width:min(680px,100%);margin:0 auto}.math-game .math-game-shelf-zone{min-height:142px;border:2px solid #b69e74;border-bottom:9px solid #ad9269;border-radius:22px 18px 13px 15px;background:#f0e2c4;color:#405e4b;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:14px;box-shadow:inset 0 -3px #f9efd6;position:relative;isolation:isolate}.math-game .math-game-shelf-zone:before{content:'';position:absolute;inset:8px;border:1px dashed #c7b48c;border-radius:15px;pointer-events:none;z-index:-1}.math-game .math-game-shelf-zone small{font-size:14px;line-height:1.2}.math-game .math-game-shelf-zone b{font-size:28px;line-height:1.2}.math-game .math-game-shelf-zone span{font-size:12px}.math-game .math-game-shelf-zone.filled{background:#e2e8c9;border-color:#8fa67a}.math-game .math-game-shelf-zone.filled b{font-size:38px}.math-game .math-game-shelf-result-zone{width:min(680px,100%);min-height:65px;margin:8px auto;font-size:16px}.math-game .math-game-shelf-compute-source{display:flex;justify-content:center;align-items:center;gap:18px}.math-game .math-game-shelf-compute-source>.math-game-pile{min-width:112px;min-height:84px;display:flex;align-items:center;gap:8px;border:2px solid #bea779;border-radius:18px;background:#f2e4c2;color:#405e4b}.math-game .math-game-shelf-compute-source>.math-game-pile svg{width:62px;height:48px}.math-game .math-game-shelf-compute-source>.math-game-pile b,.math-game .math-game-shelf-compute-choices strong{font-size:30px}.math-game .math-game-shelf-compute-source>.math-game-pile.placed{background:#dfe9c9;border-color:#86a272}.math-game .math-prior-use{display:flex;gap:12px;min-height:43px;overflow:hidden}.math-game .math-prior-use>svg{position:static;flex:0 0 45px;width:45px;min-width:45px;transform:none;animation:none}.math-game .math-prior-use>span{flex:1;min-width:0;font-size:12px}.math-game .math-prior-use>svg:last-child{margin-left:auto;animation:none;transform:none}
@media(min-width:801px) and (max-height:820px){.math-game .math-game-hand-shelf .math-game-chip-row{margin-bottom:12px}.math-game .math-game-hand-shelf .math-game-token.kind-wood{min-height:94px}.math-game .math-game-shelf-zone{min-height:126px}}
@media(max-width:800px){.math-game .math-game-hand-shelf .math-game-chip-row{gap:16px}.math-game .math-game-hand-shelf .math-game-token.kind-wood{width:126px;min-height:102px;grid-template-columns:40px 1fr;padding:9px}.math-game .math-game-hand-shelf .math-game-token.kind-wood svg{width:40px;height:45px}.math-game .math-game-hand-shelf .math-game-token.kind-wood strong{font-size:34px}.math-game .math-game-shelf-zones{gap:12px}.math-game .math-game-shelf-zone{padding:13px 7px;min-height:148px}.math-game .math-game-shelf-zone small{font-size:13px}.math-game .math-game-shelf-zone b{font-size:23px}.math-game .math-game-shelf-zone span{font-size:11px}.math-game .math-game-shelf-compute-source{gap:8px}.math-game .math-game-shelf-compute-source>.math-game-pile{min-width:95px;padding:8px;gap:3px}.math-game .math-game-shelf-compute-source>.math-game-pile svg{width:40px}.math-game .math-game-shelf-compute-source>.math-game-pile b{font-size:26px}.math-game .math-game-shelf-result-zone{min-height:70px;font-size:14px}}
.math-game .math-reduce-setting{display:flex;align-items:center;gap:12px;min-height:48px;margin:12px 0;padding:10px 12px;background:#e6ecd4;border-radius:14px;cursor:pointer}.math-game .math-reduce-setting input{width:24px;height:24px;accent-color:#54754c}.math-game.reduce *,.math-game.reduce *::before,.math-game.reduce *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.math-game.reduce .math-performance>div,.math-game.reduce .performance-result svg{opacity:1!important}.math-game.reduce .math-game-falling-number{animation:none!important;transition:none!important}
@media(prefers-reduced-motion:reduce){.math-game *,.math-game *::before,.math-game *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.math-game .math-performance>div,.math-game .performance-result svg{opacity:1!important}}
.math-game .math-game-flip-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:min(560px,100%);min-width:0;gap:14px;align-self:center;margin:8px auto}.math-game .math-game-flip-card{width:100%;min-width:0;min-height:105px;padding:14px;font-size:24px;overflow-wrap:anywhere}.math-game .math-game-flip-card i{font-size:32px}.math-game .math-game-hand-blocks{display:grid;grid-template-columns:125px minmax(0,1fr);grid-template-areas:'equation source' 'columns columns' 'carry carry' 'controls controls' 'submit submit';gap:9px;align-content:start;width:100%}.math-game .math-game-hand-blocks>.math-game-vertical-expression{grid-area:equation;width:115px;margin:0;padding:8px 12px;align-self:start;font-size:23px;line-height:1.1}.math-game .math-game-hand-blocks>.math-game-vertical-expression hr{margin:4px 0}.math-game .math-game-hand-blocks>.math-game-block-source-row{grid-area:source;min-width:0;width:100%;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.math-game .math-game-block-source{display:flex;flex-direction:column;gap:5px;min-width:0}.math-game .math-game-block-source>span{font-size:12px}.math-game .math-game-block-source>button{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:2px;width:100%;min-height:80px;padding:5px 8px}.math-game .math-game-block-source>button svg{width:30px;height:27px;flex:0 0 30px}.math-game .math-game-block-source>button b{flex-basis:100%;font-size:12px}.math-game .math-game-hand-blocks>.math-game-place-columns{grid-area:columns;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:100%}.math-game .math-game-block-column{min-height:82px;padding:8px;background:#e7edd3;border:1px solid #b4c49a;border-radius:16px;min-width:0}.math-game .math-game-block-column h3{font-size:13px;margin:0 0 4px}.math-game .math-game-blocks{display:flex;flex-wrap:wrap;gap:2px;min-height:35px}.math-game .math-game-blocks svg{width:32px;height:30px;flex:0 0 32px}.math-game .math-game-hand-blocks>.math-game-carry-row{grid-area:carry;margin:0;min-height:48px}.math-game .math-game-hand-blocks>.math-game-controls{grid-area:controls;margin:0;min-height:32px}.math-game .math-game-hand-blocks>.math-game-submit-bar{grid-area:submit}.math-game .math-game-block-next{min-height:48px}.math-game .math-game-block-progress{font-size:11px}.math-game .math-game-scale-beam.balanced i{transform:rotate(0)}.math-game .math-game-scale-beam.unbalanced i{transform:rotate(-9deg)}.math-game .math-recognize-money{display:flex;align-items:center;justify-content:center;gap:16px;min-height:110px;margin:0 0 8px;padding:8px;background:#e9eed7;border-radius:20px}.math-game .math-recognize-money>span{font-size:14px}.math-game .math-recognize-money svg{width:225px;height:122px;flex:none}
@media(max-width:800px){.math-game .math-game-flip-grid{gap:12px;width:100%}.math-game .math-game-flip-card{min-height:115px;font-size:20px}.math-game .math-game-hand-blocks{grid-template-columns:82px minmax(0,1fr);gap:8px}.math-game .math-game-hand-blocks>.math-game-vertical-expression{width:78px;font-size:20px;padding:8px}.math-game .math-game-block-source-row{gap:5px}.math-game .math-game-block-source>button svg{width:23px;height:23px;flex-basis:23px}.math-game .math-game-block-source>button{padding:5px;min-height:100px}.math-game .math-game-block-source>span{font-size:10px}.math-game .math-game-blocks svg{width:26px;height:26px;flex-basis:26px}.math-game .math-game-block-column h3{font-size:11px}.math-game .math-recognize-money{gap:8px}.math-game .math-recognize-money svg{width:185px;height:108px}}
.math-game .math-game-flip-grid{flex:0 0 auto;grid-template-rows:repeat(2,minmax(105px,auto))}.math-game .math-game-hand-sort .kind-card,.math-game .math-game-catch-actions .kind-number{min-width:76px;min-height:76px;position:relative;display:grid;place-items:center;padding:8px;background:#f3e4bf;border:1px solid #bead80;border-radius:16px}.math-game .math-game-hand-sort .kind-card svg,.math-game .math-game-catch-actions .kind-number svg{display:none}.math-game .math-game-hand-sort .kind-card strong,.math-game .math-game-catch-actions .kind-number strong{font-size:30px;line-height:1.2;color:#40634f}.math-game .math-game-pair-card{min-width:90px;min-height:88px}.math-game .math-game-pair-card strong{font-size:23px}
.math-game .math-card-target{display:flex;align-items:center;justify-content:center;gap:16px;background:#e7edcf;border:1px solid #b8c69c;border-radius:16px;min-height:70px;padding:10px;margin-bottom:8px}.math-game .math-card-target span{font-size:14px}.math-game .math-card-target strong{font-size:36px;color:#3f6850}

/* A visible friend gives the short goal a speaker, without another card. */
.math-game-quest-title .math-task-host{display:block;flex:0 0 64px;width:64px;height:74px;overflow:hidden;align-self:center}
.math-game-quest-title .math-task-host svg{width:64px;height:76px;display:block}
.math-game-quest-title>div{flex:1;min-width:0}
.math-counted-group{position:relative;display:inline-flex;align-items:center;justify-content:center;width:76px;height:64px}
.math-counted-group>svg{width:100%!important;height:100%!important}
.math-counted-group>b{position:absolute;right:0;bottom:0;background:#fff4d8;border:2px solid #967954;border-radius:50%;min-width:30px;height:30px;font-size:20px;line-height:26px;color:#58472f}
@media(max-width:600px){.math-game-quest-title .math-task-host{flex-basis:48px;width:48px;height:62px}.math-game-quest-title .math-task-host svg{width:48px;height:62px}.math-game-quest-title{gap:8px}}

.math-game-choice-card>strong,.math-game-pile-card>strong,.math-game-pair-card>strong{font-size:28px!important;line-height:1.2}
.math-game-quest-title{display:flex;flex-direction:row;align-items:center}
.math-game-hand-compose .math-game-bundles>svg{max-height:140px;width:220px}
@media(max-width:600px){
 .math-game-station .math-game-quest-title{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}
 .math-game-station .math-game-quest-title>div{flex:1;min-width:190px}
 .math-game-station .math-game-quest-title>.math-game-audio{margin-left:auto;min-height:44px}
 .math-game-station .math-game-quest{padding:12px}
 .math-game-station .math-game-quest-title h2{font-size:21px}
}

.math-game-ten-frame-toggle{min-height:44px;padding:8px 14px;border:1px solid #b5c6a8;border-radius:18px;background:#f6edcf;color:#405c4c}
.math-game-controls>button{min-height:44px;padding:8px 12px}

.math-lamp-quantity{display:flex;flex-direction:column;align-items:center;width:130px;max-width:100%;gap:0}
.math-lamp-quantity>svg{display:block;width:120px!important;height:24px!important;max-width:100%}
.math-game-hand-shelf .math-game-shelf-compute-source .math-game-pile{min-height:128px}
.math-game-hand-shelf .math-game-shelf-compute-choices .math-game-choice-card{display:flex;flex-direction:column;min-height:96px}
.math-game-bundle-source .math-counted-group{width:62px;height:53px}
.math-game-bundle-source{flex-wrap:wrap}
/* The small-number table uses the cottage's paper, fruit and wooden-box palette. */
.math-game .math-foundation{display:flex;flex-direction:column;gap:14px;min-width:0}
.math-game .math-foundation-table{display:flex;flex-direction:column;align-items:center;gap:16px;background:var(--paper);border-radius:20px;padding:18px;min-width:0}
.math-game .math-foundation-items{display:flex;flex-wrap:wrap;justify-content:center;align-content:center;gap:6px;max-width:560px;min-width:0}
.math-game .math-foundation-item{position:relative;display:grid;place-items:center;width:48px;height:48px;min-width:48px;min-height:48px;padding:1px;border:2px solid transparent;border-radius:12px;background:transparent;color:var(--ink);box-sizing:border-box}
.math-game .math-foundation-item svg{display:block;width:42px;height:42px}
.math-game .math-foundation-item.marked,.math-game .math-foundation-item.selected{border-color:var(--green);background:#e5eee1}
.math-game .math-foundation-item.removed{background:var(--paper-deep);border-style:dashed;border-color:var(--coral)}
.math-game .math-foundation-item.removed svg{opacity:.35}
.math-game .math-foundation-item.removed:after{content:'';position:absolute;width:35px;height:2px;background:var(--ink);transform:rotate(-40deg)}
.math-game .math-foundation-mark{position:absolute;right:0;top:-4px;font-size:15px;line-height:20px;color:var(--green-dark);background:var(--paper);border-radius:50%;width:20px;height:20px;text-align:center}
.math-game .math-foundation-plates{display:flex;align-items:center;justify-content:center;gap:16px;width:100%;min-width:0}
.math-game .math-foundation-plate{display:flex;align-items:center;justify-content:center;min-width:0;flex:1;padding:14px;border:2px solid var(--paper-deep);border-radius:30px;background:#fffaf0;color:var(--ink)}
.math-game button.math-foundation-plate{min-height:130px}
.math-game .math-foundation-plate.selected{border-color:var(--green-dark);background:#e5eee1}
.math-game .math-foundation-plates.paired .math-foundation-items{display:grid;grid-template-columns:repeat(2,48px);align-content:start}
.math-game .math-foundation-plates.paired{align-items:flex-start}
.math-game .math-foundation-operator{font-size:30px;font-weight:700}
.math-game .math-foundation-boxes{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:12px}
.math-game .math-foundation-box{display:flex;flex-direction:column;align-items:center;gap:7px;flex-shrink:0;padding:10px 12px;background:var(--paper-deep);border:2px solid #bc986e;border-radius:12px;color:var(--ink)}
.math-game .math-foundation-box-dots{display:grid;grid-template-columns:repeat(5,12px);gap:5px}
.math-game .math-foundation-box-dots i{height:12px;width:12px;background:var(--coral);border:1px solid var(--ink);border-radius:50%}
.math-game .math-foundation-expression,.math-game .math-foundation-number{font-size:clamp(30px,5vw,52px);font-weight:800;line-height:1.5;font-variant-numeric:tabular-nums}
.math-game .math-foundation-answers{display:flex;justify-content:center;gap:16px}
.math-game .math-foundation-answers[hidden]{display:none}
.math-game .math-foundation-answer{width:70px;height:60px;border-radius:16px;border:2px solid var(--paper-deep);background:var(--paper);color:var(--ink);font-size:30px;font-weight:800}
.math-game .math-foundation-answer.selected{border-color:var(--green-dark);background:#e5eee1}
.math-game .math-foundation-help{margin:0;padding:10px 16px;border-radius:12px;background:#e5eee1;line-height:1.6}
.math-game .math-foundation button,.math-game .math-learning-starts button{min-height:44px;touch-action:manipulation}
.math-game .math-foundation button:focus-visible,.math-game .math-learning-starts button:focus-visible{outline:3px solid var(--green-dark);outline-offset:3px}
.math-game .math-foundation button:active:not(:disabled){transform:scale(.97)}
.math-game .math-learning-panel{margin:20px 0;padding:16px;background:var(--paper);border-radius:16px}
.math-game .math-learning-starts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.math-game .math-learning-starts button{padding:8px;border:1px solid var(--green);border-radius:10px;background:#fffaf0;color:var(--ink)}
.math-game .math-learning-starts button[aria-pressed=true]{background:#e5eee1;border:2px solid var(--green-dark)}
@media(max-width:600px){
.math-game .math-foundation-table{padding:10px;gap:12px}
.math-game .math-foundation-plates{gap:6px}
.math-game .math-foundation-plate{padding:8px 4px;border-radius:20px}
.math-game .math-foundation-plate .math-foundation-items{gap:2px}
.math-game .math-foundation-operator{font-size:23px}
.math-game .math-foundation-items{gap:4px}
.math-game .math-foundation-answers{gap:12px}
.math-game .math-foundation-answer{width:64px;height:56px}
.math-game .math-foundation-plates.paired .math-foundation-items{grid-template-columns:repeat(2,44px)}
.math-game .math-foundation-plate .math-foundation-item{width:44px;height:44px;min-width:44px;min-height:44px}
.math-game .math-foundation .math-game-controls{flex-wrap:wrap}
}

.math-game .math-foundation-step{margin:0;text-align:center;font-size:17px;line-height:1.55;font-weight:700;color:var(--ink);text-wrap:balance}
