@font-face{font-family:'DM Sans';src:url('./assets/dm-sans-400.woff2') format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:'DM Sans';src:url('./assets/dm-sans-500.woff2') format('woff2');font-weight:500 600;font-display:swap}
@font-face{font-family:'DM Sans';src:url('./assets/dm-sans-700.woff2') format('woff2');font-weight:700 900;font-display:swap}
:root{--ink:#28243d;--muted:#787287;--purple:#6951c9;--purple-dark:#543cae;--lavender:#f0ecfb;--cream:#faf9f6;--line:#e9e4ef;--yellow:#ffe24c;--font:'DM Sans',Arial,sans-serif}
*{box-sizing:border-box}body{margin:0;background:var(--cream);color:var(--ink);font:14px/1.45 var(--font);-webkit-font-smoothing:antialiased}button,input{font:inherit;color:inherit}button{cursor:pointer;border:0}button,a{touch-action:manipulation;-webkit-tap-highlight-color:transparent}a{color:inherit;text-decoration:none}button:disabled{cursor:default;opacity:.4}svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid var(--purple);outline-offset:4px}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.skip-link{position:fixed;top:-100px;left:16px;padding:12px;background:var(--yellow);z-index:100}.skip-link:focus{top:12px}
.container{max-width:1100px;width:calc(100% - 64px);margin:auto;padding-top:20px}.subtle-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;padding:8px 12px;background:transparent;border-radius:8px;font-size:12px;font-weight:600;white-space:nowrap}.subtle-button:hover:not(:disabled){background:var(--lavender)}.fullscreen-button{border:1px solid #d0d8cd}.fullscreen-button svg{width:17px;height:17px}.primary-button{display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:44px;padding:10px 18px;background:var(--purple);border:1px solid var(--purple);border-radius:10px;box-shadow:0 3px 0 #533caa;color:white;font-weight:700;white-space:nowrap}.primary-button:hover:not(:disabled){background:var(--purple-dark)}.primary-button:active:not(:disabled){transform:translateY(2px);box-shadow:0 1px 0 #533caa}.text-button{padding:4px 6px;background:none;color:var(--purple);font-size:11px;font-weight:600;border-radius:6px;min-height:25px}.text-button:hover{background:var(--lavender)}
.settings-card{position:relative;display:grid;grid-template-columns:190px minmax(130px,190px) 20px minmax(100px,145px) auto;align-items:center;gap:20px;width:fit-content;max-width:100%;margin:auto;padding:16px 22px;background:white;border:1px solid var(--line);border-radius:20px;box-shadow:0 8px 30px #39304b06}.digit-field{border:0;padding:0;margin:0;min-width:0}.digit-field legend,.number-field{font-size:11px;font-weight:700}.digit-field legend{padding:0;margin-bottom:8px}.digit-options{display:flex;gap:6px}.digit-options button{width:40px;height:43px;border:1px solid #d6cce7;background:white;border-radius:9px;font-weight:700;font-size:16px}.digit-options button[aria-pressed=true]{background:var(--lavender);border:2px solid var(--purple);color:var(--purple)}.digit-options button:hover{background:var(--lavender)}.number-field{display:block;min-width:0}.number-field input{display:block;width:100%;height:44px;margin-top:8px;border:1px solid #d8cde8;border-radius:9px;padding:8px 12px;background:#fcfaff;font-size:23px;font-weight:600;font-variant-numeric:tabular-nums}.number-field input::placeholder{font-size:17px;color:#9d95ac;font-weight:400}.setup-times{font-size:25px;color:#9c90ae;padding-top:22px}.setup-actions{display:flex;flex-direction:column;gap:2px;justify-content:center}.setup-actions>.primary-button{font-size:13px}.setup-actions>.text-button{min-height:22px;font-size:10px}.setup-error{grid-column:1/-1;color:#9a3b2e;font-size:12px;margin:0}.number-field input[aria-invalid=true]{border-color:#b84b3d}
.feedback-slot{height:42px;display:flex;align-items:center;justify-content:flex-end;padding:3px 18px}.feedback-slot p{font-size:13px;font-weight:500;color:#32664d;margin:0;text-align:right}.feedback-slot p.is-error{color:#9a4633}.demo-card{overflow:hidden;border:1px solid var(--line);border-radius:20px;background:white;box-shadow:0 8px 30px #39304b06}.equation-bar{display:flex;align-items:center;justify-content:space-between;height:61px;padding:10px 25px;border-bottom:1px solid var(--line)}.equation{display:flex;align-items:center;gap:12px;font-size:26px;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}.equation .operator{color:#9c90ae;font-weight:400}.equation-answer{background:var(--lavender);color:var(--purple);border-radius:8px;padding:2px 10px;min-width:40px;text-align:center}.equation-answer.done{background:var(--yellow);color:var(--ink)}.empty-equation{font-size:17px;font-weight:500;color:#9d95ac}
.demonstration-body{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);height:376px;align-items:center}.chart-area{padding:24px;min-width:0;display:flex;align-items:center;justify-content:center}.board{display:grid;position:relative;grid-template-columns:repeat(var(--cols,7),minmax(0,1fr));grid-template-rows:repeat(6,minmax(0,1fr));width:min(100%,calc(var(--cols,7)*50px));aspect-ratio:var(--cols,7)/6;border-left:1px solid #d7d3dc;border-top:1px solid #d7d3dc;isolation:isolate}.paper-cell{border-right:1px solid #d7d3dc;border-bottom:1px solid #d7d3dc;z-index:-1;background:white;min-width:0;min-height:0}.digit{display:flex;align-items:center;justify-content:center;align-self:center;justify-self:center;width:calc(100% - 5px);height:calc(100% - 5px);border:2px solid transparent;border-radius:6px;font-size:33px;line-height:1;font-weight:500;font-variant-numeric:tabular-nums;z-index:1;min-width:0;min-height:0;color:#25222b}.operation{display:flex;align-items:center;justify-content:center;font-size:28px;color:#25222b;font-weight:500}.calculation-rule{align-self:start;border-top:2px solid #3e3945;transform:translateY(-1px);z-index:3}.whole-frame{align-self:center;height:calc(100% - 3px);border:2px solid #e4c65c;border-radius:6px;background:#fffbed;margin-inline:1px;z-index:0}.digit.top-active{background:var(--yellow);border-color:#cfad2f}.digit.multiplier-active{background:var(--purple);border-color:var(--purple-dark);color:white}.digit.placeholder{color:#9b91a5}.digit.sum-active{background:var(--lavender);border-color:#aa93d5;color:var(--purple-dark)}.digit.answer-digit{font-weight:600}.digit.target{border:1.5px dashed #b9a6db;background:#fcfaff;color:#b0a1c2;font-size:22px}.digit.target:after{content:'?'}.digit.new-digit{background:var(--lavender);border-color:#d5c5ed;animation:pop .28s ease-out}.carry-digit{display:flex;align-items:center;justify-content:center;align-self:center;justify-self:center;width:25px;height:25px;font-size:17px;line-height:1;color:#9c8bad;font-weight:600;border:1px solid transparent;border-radius:5px;z-index:3}.carry-digit.carry-active,.carry-digit.new-carry{background:#ffe999;border-color:#d9ba4a;color:#735414}.carry-digit.new-carry{animation:pop .28s ease-out}.carry-digit.addition-carry{align-self:start;justify-self:end;width:16px;height:16px;margin:1px 2px 0 0;font-size:11px}
.response-area{min-width:0;padding:25px 30px;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;height:100%}.response-area #description{font-size:17px;font-weight:600;color:var(--muted);margin:0 0 20px;min-height:25px}.response-area h2{font-size:32px;line-height:1.65;white-space:nowrap;width:100%;margin:0 0 24px;height:55px;font-weight:700;letter-spacing:-.4px}.question-top,.question-bottom,.question-carry{border-radius:6px;padding:2px 4px}.question-top{background:#fff3ac}.question-bottom{background:var(--lavender);color:var(--purple)}.question-carry{background:#ffe999;color:#735414}.answer-form{display:flex;align-items:center;gap:11px;height:49px;width:100%;max-width:310px}.answer-wrap{display:flex;align-items:center;border:1.5px solid #cabcdf;border-radius:10px;background:#fcfaff;height:47px;min-width:0;max-width:155px;flex:1}.answer-wrap:focus-within{border-color:var(--purple);outline:3px solid #6951c91a}.answer-wrap input{border:0;background:transparent;outline:0!important;min-width:0;width:100%;padding:7px 4px 7px 14px;font-size:25px;font-weight:600;font-variant-numeric:tabular-nums}.answer-wrap input::placeholder{color:#beb2d1}.answer-wrap button{display:grid;place-items:center;width:37px;height:42px;flex-shrink:0;color:#8e7da7;background:transparent;border-radius:8px}.answer-wrap button:hover{background:var(--lavender)}.answer-wrap.correct{background:#f0f8ef;border-color:#95be91}.answer-wrap.incorrect{border-color:#c56b5a;background:#fff8f5}.answer-form>.primary-button{min-width:113px;font-size:13px}.answer-form>.primary-button:disabled{opacity:1;color:#3f7548;background:#eef6ec;border-color:#bcd4b9;box-shadow:0 3px 0 #d8e6d3}.complete-result{height:49px;font-size:33px;font-weight:700;color:var(--purple);line-height:49px;white-space:nowrap}.step-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid var(--line);height:59px;padding:7px 18px}.back-controls{display:flex;gap:5px;align-items:center}.step-count{font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}.next-button{min-height:39px;min-width:132px;font-size:12px;padding:8px 14px}.next-button:disabled{color:#a397b6;background:#f1edf8;border-color:#ebe5f3;box-shadow:0 3px 0 #e8e1f1;opacity:1}footer{padding:17px 4px 21px;color:#92889d;font-size:10px}footer a{font-weight:600}
.keypad{position:fixed;right:25px;bottom:22px;z-index:20;width:270px;background:white;border:1px solid #d8cde8;border-radius:16px;box-shadow:0 12px 60px #32224530;padding:13px}.keypad-title{display:flex;align-items:center;justify-content:space-between;font-size:12px;margin-bottom:9px}.keypad-title button{font-size:24px;min-height:30px;padding:0 10px}.keypad-keys{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.keypad-keys button{height:45px;border:1px solid #d9cee9;border-radius:8px;background:#fcfaff;font-size:21px;font-weight:600}.keypad-keys button:hover{background:var(--lavender)}.keypad-keys button.small-key{font-size:11px}.keypad>.primary-button{width:100%;margin-top:9px;min-height:40px;font-size:12px}
#app:fullscreen,.presentation{min-height:100vh;overflow:auto;background:var(--cream)}.presentation{position:fixed;inset:0;z-index:50;height:100dvh}.presentation .container,#app:fullscreen .container{max-width:1300px}.presentation header .header-actions>a,#app:fullscreen header .header-actions>a{display:none}
@keyframes pop{0%{transform:scale(.7);opacity:.5}70%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}
@media(max-width:1000px){.container{width:calc(100% - 40px)}.settings-card{grid-template-columns:170px minmax(120px,1fr) 14px minmax(95px,.75fr) auto;gap:12px;width:100%;padding-inline:16px}.digit-options{gap:5px}.digit-options button{width:36px}.setup-actions>.primary-button{font-size:11px;padding-inline:12px}.chart-area{padding:19px}.response-area{padding:24px}.digit{font-size:29px}}
@media(max-width:760px){.container{width:calc(100% - 24px);padding-top:14px}.settings-card{grid-template-columns:minmax(0,1.2fr) 14px minmax(0,1fr);gap:12px;padding:14px;border-radius:16px}.digit-field{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:10px}.digit-field legend{float:left;margin:0;line-height:34px;font-size:11px}.digit-options button{height:34px;width:36px}.number-field{grid-column:1;grid-row:2}.number-field[for=multiplier]{grid-column:3}.setup-times{grid-column:2;grid-row:2;padding-top:21px}.setup-actions{grid-column:1/-1;flex-direction:row;gap:13px;align-items:center}.setup-actions>.primary-button{flex:1;font-size:12px}.setup-actions>.text-button{font-size:10px}.number-field input{margin-top:5px;height:42px;font-size:22px}.feedback-slot{height:46px;padding:4px 8px;justify-content:center}.feedback-slot p{text-align:center;font-size:12px;line-height:17px}.demo-card{border-radius:16px}.equation-bar{height:58px;padding:9px 16px}.equation{font-size:22px;gap:8px}.demonstration-body{display:flex;flex-direction:column;height:505px;justify-content:center;align-items:stretch}.chart-area{width:100%;height:310px;padding:14px 18px;flex-shrink:0}.board{width:min(100%,calc(var(--cols,7)*44px))}.digit{font-size:clamp(22px,5vw,31px);border-radius:5px;width:calc(100% - 3px);height:calc(100% - 3px)}.carry-digit{font-size:15px;width:21px;height:21px}.carry-digit.addition-carry{font-size:10px;width:13px;height:13px}.operation{font-size:24px}.response-area{height:195px;flex-shrink:0;align-self:center;width:100%;max-width:460px;padding:12px 23px 24px}.response-area #description{font-size:15px;margin:0 0 5px;min-height:22px}.response-area h2{height:48px;line-height:48px;margin-bottom:10px}.answer-form{height:45px;max-width:315px}.answer-wrap{height:44px}.answer-form>.primary-button{min-height:42px}.step-controls{height:57px;padding:6px 10px;gap:6px}.back-controls{gap:0}.back-controls>.subtle-button{padding:7px 8px;font-size:10px;gap:4px}.step-count{font-size:9px}.next-button{min-width:104px;font-size:11px;gap:8px;padding:8px 10px;min-height:38px}footer{font-size:9px;padding:14px 4px}.keypad{right:12px;bottom:12px;width:240px}.keypad-keys button{height:43px}}
@media(max-width:390px){.chart-area{padding-inline:12px}.equation{font-size:19px;gap:7px}.digit{font-size:23px}.digit.target{font-size:18px}.operation{font-size:21px}.response-area{padding-inline:19px}.step-controls{padding-inline:6px}.back-controls>.subtle-button{padding-inline:6px}.next-button{min-width:96px;font-size:10px}.digit-field legend{font-size:10px}.digit-options{gap:4px}.digit-options button{width:32px}.carry-digit{width:19px;height:19px;font-size:13px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
/* Enter the answer as part of the calculation, immediately after '='. */
.answer-form{flex-direction:column;align-items:flex-start;gap:12px;height:113px;max-width:100%}
.answer-line{display:flex;align-items:center;gap:8px;width:100%;height:55px;min-width:0}
.response-area #question{flex:0 1 auto;min-width:0;width:auto;height:55px;line-height:55px;margin:0}
.answer-line .answer-wrap{flex:0 0 106px;width:106px;max-width:106px}
.answer-line .answer-wrap input{padding-left:9px}
.answer-line .answer-wrap button{width:31px}
.response-area #empty-question{white-space:normal;font-size:23px;line-height:1.35;height:auto;min-height:55px}
@media(max-width:760px){
 .answer-form{height:104px;gap:12px}
 .answer-line,.response-area #question{height:48px;line-height:48px}
 .answer-line .answer-wrap{flex-basis:92px;width:92px;max-width:92px}
 .answer-line .answer-wrap input{font-size:24px;padding-left:8px}
 .answer-line .answer-wrap button{width:28px}
}
@media(max-width:390px){.answer-line .answer-wrap{flex-basis:88px;width:88px;max-width:88px}.answer-line .answer-wrap button{width:27px}}
/* Direct entry on the paper, with two compact layout options. */
select{font:inherit;color:inherit}.layout-options{display:flex;gap:22px;align-items:center;width:fit-content;max-width:100%;margin:auto;padding:12px 20px;background:white;border:1px solid var(--line);border-radius:16px}.layout-options label{display:flex;align-items:center;gap:10px;font-size:11px;font-weight:600}.layout-options select{height:35px;max-width:150px;padding:6px 25px 6px 10px;border:1px solid #d8cde8;border-radius:8px;background:#fcfaff;font-size:12px;outline-offset:3px}.entry-digit{position:relative;align-self:center;justify-self:center;width:calc(100% - 6px);height:calc(100% - 6px);min-width:0;min-height:0;padding:0;border:1.5px solid #b5a1d8;border-radius:6px;background:#faf7ff;color:var(--ink);font:500 31px/1 var(--font);font-variant-numeric:tabular-nums;text-align:center;z-index:3;caret-color:var(--purple)}.entry-digit::placeholder{color:#beb0d2;opacity:1}.entry-digit.optional-digit:not(.filled){border:1px dashed #d6cce4;background:#fdfcfe}.entry-digit.optional-digit:not(.filled)::placeholder{color:#d8d0e3}.entry-digit:focus{border:2px solid var(--purple);outline:2px solid #6951c926;outline-offset:1px;background:#f2ecff}.entry-digit[aria-invalid=true]{border-color:#b85c4d;background:#fff7f3}.entry-row-label{align-self:center;text-align:left;padding:0 7px;line-height:1.4;color:var(--muted);z-index:2}.entry-row-label strong{display:block;font-size:10px;font-weight:600}.entry-row-label span{display:block;font-size:9px;color:#a398b0;margin-top:2px}.paper-cell.carry-band{background:#fcfaff;border-bottom-color:#e5dfed}.carry-digit.below-carry{align-self:center;justify-self:center;width:22px;height:calc(100% - 2px);max-height:21px;font-size:13px;margin:0}.edit-button{color:var(--purple)}.response-area #setup-panel{width:100%;max-width:330px}.response-area #setup-panel h2{font-size:24px;line-height:1.3;height:auto;white-space:normal;margin:0 0 10px}.response-area #setup-panel p{font-size:12px;line-height:20px;margin:0 0 20px;color:var(--muted);max-width:255px}.entry-tools{display:flex;flex-wrap:wrap;gap:10px;margin-top:10px}.answer-form{height:102px;gap:8px}.auto-note{font-size:10px;line-height:17px;color:#a094ae;margin:5px 0 0}.demonstration-body{min-height:376px}
@media(max-width:1000px){.entry-digit{font-size:29px}.layout-options{gap:16px;padding-inline:16px}}
@media(max-width:760px){.layout-options{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);width:100%;gap:14px;padding:11px 13px}.layout-options label{display:flex;flex-direction:column;align-items:flex-start;gap:5px;font-size:10px}.layout-options select{width:100%;max-width:none;min-width:0;height:34px;font-size:11px;padding-left:8px}.demonstration-body{height:525px;min-height:525px}.chart-area{height:330px}.entry-digit{font-size:clamp(22px,5vw,30px);width:calc(100% - 4px);height:calc(100% - 4px);border-radius:4px}.entry-row-label{padding-inline:4px}.entry-row-label strong{font-size:9px}.entry-row-label span{font-size:8px}.carry-digit.below-carry{font-size:10px;width:16px;max-height:18px}.response-area #setup-panel h2{font-size:22px;margin-bottom:6px}.response-area #setup-panel p{font-size:11px;margin-bottom:13px;line-height:17px}.response-area #setup-panel>.primary-button{font-size:12px;min-height:42px}.entry-tools{margin-top:5px}.answer-form{height:98px}.auto-note{font-size:9px;margin-top:4px}.edit-button{font-size:10px;padding:7px 8px}.step-count{font-size:9px}.keypad-title #keypad-title{font-size:12px}}
@media(max-width:390px){.entry-digit{font-size:23px}.entry-row-label strong{font-size:8px}.entry-row-label span{font-size:7px}.entry-tools{gap:7px}.entry-tools .text-button{font-size:10px}.edit-button{font-size:9px;padding-inline:6px}.carry-digit.below-carry{font-size:9px;width:14px}}
.layout-options select{appearance:none;-webkit-appearance:none;background:#fcfaff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m2 2 4 4 4-4' fill='none' stroke='%236951c9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;background-size:12px 8px;padding-right:25px}
.layout-options .mode-option select{width:90px}
@media(max-width:760px){.layout-options .mode-option{grid-column:1/-1;flex-direction:row;align-items:center;justify-content:center;gap:10px}.layout-options .mode-option select{width:90px;flex:0 0 90px}}
/* A permanent keypad belongs to the workspace; numeric fields never open a phone keyboard. */
.container{position:relative}.chart-area{height:100%;min-height:0}.response-area{padding:16px 28px}
.response-area #setup-panel .setup-heading{display:flex;align-items:center;gap:8px;width:100%}
.response-area #setup-panel .setup-heading h2{flex:1;min-width:0;width:auto;font-size:20px;line-height:1.2;height:auto;margin:0}
.response-area #setup-panel>p{font-size:11px;line-height:18px;margin:4px 0 6px;max-width:none}
.setup-heading #example{flex:0 0 auto;font-size:10px;padding:3px 5px}
.docked-keypad{position:static;inset:auto;z-index:auto;width:100%;max-width:270px;margin:8px 0 0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;align-self:flex-start;flex-shrink:0}
.docked-keypad .keypad-keys{gap:5px}.docked-keypad .keypad-keys button{height:34px;font-size:20px;border-radius:7px;background:#faf7ff}
.docked-keypad .keypad-keys .small-key{font-size:10px}.docked-keypad>.primary-button{margin-top:6px;min-height:34px;height:34px;padding:5px 10px;font-size:12px}
.keypad-targets{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-bottom:6px}
.keypad-targets button{height:27px;padding:4px 6px;border:1px solid #ddd3eb;border-radius:7px;background:#fff;font-size:11px;font-weight:600;color:#82748f}
.keypad-targets button[aria-pressed=true]{border-color:var(--purple);background:var(--lavender);color:var(--purple)}
.entry-digit.selected-entry{border:2px solid var(--purple);background:#f2ecff;box-shadow:0 0 0 2px #6951c914}
.answer-form{height:50px;gap:0}.answer-line{height:46px}.response-area #question{height:46px;line-height:46px}
.answer-line .answer-wrap{flex-basis:80px;width:80px;max-width:80px}.answer-wrap input{caret-color:var(--purple)}
.board .digit,.board .entry-digit{font-size:clamp(15px,calc(var(--square,50px)*.62),33px)}
.board .digit.target{font-size:clamp(12px,calc(var(--square,50px)*.44),22px)}
.board .operation{font-size:clamp(14px,calc(var(--square,50px)*.55),28px)}
.board .entry-row-label strong{font-size:clamp(7px,calc(var(--square,50px)*.2),10px)}
.board .entry-row-label span{font-size:clamp(6px,calc(var(--square,50px)*.18),9px)}
.board .carry-digit.below-carry{font-size:clamp(8px,calc(var(--square,50px)*.32),13px);max-height:calc(var(--square,50px)*.46)}
/* Compact screens use a keypad beside the paper in landscape, and below it in portrait. */
#app.compact-ui header.mw-app-header{min-height:62px!important;padding:6px 10px!important;gap:6px!important;flex-wrap:nowrap!important}
#app.compact-ui header.mw-app-header .mw-app-brand{flex:1 1 auto!important;min-width:0!important;gap:7px!important}
#app.compact-ui header.mw-app-header .mw-app-copy{max-width:none!important;min-width:0!important}
#app.compact-ui header.mw-app-header .mw-app-icon{width:38px!important;height:38px!important;min-width:38px!important;flex-basis:38px!important}
#app.compact-ui header.mw-app-header .mw-app-kicker{font-size:8px!important;letter-spacing:1.3px!important;margin-bottom:2px!important}
#app.compact-ui header.mw-app-header h1.mw-app-title{font-size:20px!important;line-height:1.05!important;letter-spacing:-.7px!important}
#app.compact-ui header.mw-app-header .header-actions{flex:0 0 auto;gap:4px;flex-wrap:nowrap}
#app.compact-ui header.mw-app-header .header-actions button{width:29px;height:30px;min-height:30px;padding:5px;border:1px solid #d0d8cd}
#app.compact-ui header.mw-app-header .header-actions button>span{display:none}
#app.compact-ui header.mw-app-header .tools-link{width:27px;min-height:30px;padding:5px;font-size:0}
#app.compact-ui header.mw-app-header .tools-link::before{content:'←';font-size:17px}
.compact-ui .container{width:calc(100% - 20px);padding-top:8px}
.compact-ui footer{display:none}.compact-ui .feedback-slot{height:26px;padding:2px 7px;justify-content:center}
.compact-ui .feedback-slot p{font-size:11px;line-height:15px;text-align:center}
.compact-ui .layout-options{position:absolute;z-index:30;top:0;left:4px;right:4px;width:auto;max-width:none;box-shadow:0 12px 30px #32224524}
.compact-ui .demo-card{display:flex;flex-direction:column;height:calc(100dvh - var(--app-header-height,62px) - 44px);min-height:500px;border-radius:14px}
.compact-ui .equation-bar{flex:0 0 42px;height:42px;padding:6px 13px;min-height:0}
.compact-ui.is-editing .equation-bar{display:none}
.compact-ui .equation{font-size:20px;gap:8px}
.compact-ui .step-controls{height:40px;flex:0 0 40px;min-height:0;padding:3px 7px}
.compact-ui .step-controls .subtle-button{min-height:30px;padding:5px 7px;font-size:10px}
.compact-ui .step-count{font-size:9px}
.compact-ui .demonstration-body{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) var(--response-height,252px);flex:1 1 auto;height:auto;min-height:0;align-items:stretch}
.compact-ui.is-editing .demonstration-body{--response-height:272px}
.compact-ui .chart-area{height:100%;width:100%;padding:8px;min-height:0}
.compact-ui .response-area{height:100%;width:100%;max-width:none;min-height:0;padding:4px 16px 8px;align-self:stretch;align-items:center;justify-content:center}
.compact-ui .response-area #setup-panel{max-width:310px}.compact-ui .response-area #setup-panel>p{display:none}
.compact-ui .response-area #setup-panel .setup-heading h2{font-size:19px}
.compact-ui .response-area #description{max-width:310px;width:100%;min-height:18px;font-size:14px;line-height:18px;margin:0 0 2px;text-align:center}
.compact-ui .answer-form{height:44px;width:100%;max-width:310px;margin:0;gap:0}
.compact-ui .answer-line{height:44px;justify-content:center}.compact-ui .response-area #question{height:44px;line-height:44px}
.compact-ui .answer-line .answer-wrap{height:42px;flex-basis:72px;width:72px;max-width:72px}
.compact-ui .answer-line .answer-wrap input{padding:6px 8px;font-size:24px}
.compact-ui .docked-keypad{max-width:310px;align-self:center;margin-top:7px}
.compact-ui .keypad-targets{margin-bottom:5px}.compact-ui .keypad-targets button{height:26px;font-size:11px}
.compact-ui .keypad-keys{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(4,36px);gap:5px}
.compact-ui .keypad-keys button{height:36px;font-size:21px}
.compact-ui .docked-keypad>.primary-button{height:34px;min-height:34px;margin-top:5px;font-size:12px}
@media(max-height:600px) and (min-width:540px){
 #app.compact-ui header.mw-app-header{min-height:50px!important;padding:6px 12px!important}
 #app.compact-ui header.mw-app-header .mw-app-icon{width:32px!important;height:32px!important;min-width:32px!important;flex-basis:32px!important}
 #app.compact-ui header.mw-app-header .mw-app-kicker{display:none!important}
 #app.compact-ui header.mw-app-header h1.mw-app-title{font-size:21px!important}
 .compact-ui .container{padding-top:4px;width:calc(100% - 20px)}
 .compact-ui .feedback-slot{height:20px;padding:1px 6px}.compact-ui .feedback-slot p{font-size:10px;line-height:14px}
 .compact-ui .demo-card{height:calc(100dvh - var(--app-header-height,50px) - 30px);min-height:0;border-radius:10px}
 .compact-ui .equation-bar{height:30px;flex-basis:30px;padding:3px 12px}.compact-ui .equation{font-size:20px;gap:8px}
 .compact-ui .equation-answer{padding:1px 8px}
 .compact-ui .step-controls{height:32px;flex-basis:32px;padding:1px 9px}
 .compact-ui .step-controls .subtle-button{min-height:26px;font-size:10px;padding:3px 7px}
 .compact-ui .demonstration-body{grid-template-columns:minmax(0,1.08fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
 .compact-ui .chart-area{padding:5px 8px}
 .compact-ui .response-area{padding:4px 12px;justify-content:center}
 .compact-ui .response-area #setup-panel .setup-heading h2{font-size:17px}
 .compact-ui .setup-heading #example{min-height:20px;font-size:10px;padding:1px 5px}
 .compact-ui .response-area #description{font-size:12px;line-height:15px;min-height:15px;margin:0}
 .compact-ui .answer-form,.compact-ui .answer-line,.compact-ui .response-area #question{height:35px;line-height:35px}
 .compact-ui .answer-line .answer-wrap{height:33px;flex-basis:67px;width:67px;max-width:67px}
 .compact-ui .answer-line .answer-wrap input{font-size:22px;padding:4px 8px}
 .compact-ui .docked-keypad{max-width:290px;margin-top:5px}
 .compact-ui .keypad-targets{margin-bottom:4px}.compact-ui .keypad-targets button{height:24px;font-size:10px;padding:2px 4px}
 .compact-ui .keypad-keys{grid-template-rows:repeat(4,32px);gap:4px}.compact-ui .keypad-keys button{height:32px;font-size:19px}
 .compact-ui .docked-keypad>.primary-button{height:28px;min-height:28px;margin-top:4px;font-size:11px;padding:3px 8px}
 .compact-ui .layout-options{display:flex;align-items:center;justify-content:center;gap:12px;padding:8px 10px;flex-wrap:wrap}
 .compact-ui .layout-options label,.compact-ui .layout-options .mode-option{flex-direction:row;align-items:center;gap:6px;font-size:10px}
 .compact-ui .layout-options select{height:30px;width:115px;flex:none}.compact-ui .layout-options .mode-option select{width:80px;flex:none}
 .compact-ui .carry-digit:not(.below-carry){max-width:calc(var(--square,30px)*.7);max-height:calc(var(--square,30px)*.7);font-size:clamp(9px,calc(var(--square,30px)*.32),17px)}
}
@media(max-height:350px) and (min-width:540px){
 #app.compact-ui header.mw-app-header{min-height:42px!important;padding-top:4px!important;padding-bottom:4px!important}
 #app.compact-ui header.mw-app-header .mw-app-icon{width:30px!important;height:30px!important;min-width:30px!important;flex-basis:30px!important}
 #app.compact-ui header.mw-app-header h1.mw-app-title{font-size:19px!important}
 .compact-ui .container{padding-top:3px}.compact-ui .feedback-slot{height:17px}
 .compact-ui .demo-card{height:calc(100dvh - var(--app-header-height,42px) - 26px)}
 .compact-ui .equation-bar{height:26px;flex-basis:26px}.compact-ui .equation{font-size:18px}
 .compact-ui .step-controls{height:28px;flex-basis:28px}
 .compact-ui .response-area{padding:3px 10px}.compact-ui .response-area #setup-panel .setup-heading h2{font-size:16px}
 .compact-ui .keypad-targets button{height:21px}.compact-ui .keypad-keys{grid-template-rows:repeat(4,30px);gap:3px}.compact-ui .keypad-keys button{height:30px;font-size:18px}
 .compact-ui .docked-keypad>.primary-button{height:26px;min-height:26px}.compact-ui .docked-keypad{margin-top:4px}
 .compact-ui .answer-form,.compact-ui .answer-line,.compact-ui .response-area #question{height:31px;line-height:31px}.compact-ui .answer-line .answer-wrap{height:30px}
}

.docked-keypad .keypad-keys [data-key='enter']{background:var(--purple);border-color:var(--purple);color:#fff;font-size:11px}.docked-keypad .keypad-keys [data-key='enter']:hover{background:#5740b5}
.board .digit.placeholder-target{background:var(--lavender);border:2px solid var(--purple);color:var(--purple);box-shadow:0 0 0 2px #6951c914}

/* Column methods share the multiplication demonstrator's paper and controls. */
#description{white-space:nowrap;max-width:100%}
.board .digit.donor-active{background:var(--lavender);border-color:var(--purple);color:var(--purple)}
.board .digit.exchanged-original{text-decoration:line-through;text-decoration-color:#b85c4d;text-decoration-thickness:2px}
.board .digit.implicit-digit{color:#a69bad}
.board .exchange-digit{display:flex;align-items:center;justify-content:center;align-self:end;justify-self:center;z-index:4;min-width:0;width:calc(100% - 5px);height:calc(var(--square,50px)*.55);max-height:28px;margin-bottom:3px;border:1px solid transparent;border-radius:5px;font-size:clamp(11px,calc(var(--square,50px)*.4),20px);font-weight:700;line-height:1;color:#6c537e;font-variant-numeric:tabular-nums}
.board .exchange-digit.exchange-active{background:var(--lavender);border-color:#b9a6db}
.board .exchange-digit.exchange-target{background:var(--lavender);border:2px solid var(--purple);color:var(--purple)}
.board .carry-digit.spent-carry{opacity:.55}
body[data-operation='subtraction'] .layout-options{grid-template-columns:1fr}

.board .exchange-digit.current-value{background:var(--yellow);border-color:#cfad2f;color:var(--ink)}
.board .digit.exchanged-original.top-active{background:transparent;border-color:transparent;color:#9c8bad}

/* Place values stay aligned with the squared columns, including decimals. */
.board .heading-cell{background:#faf8fd;border-top:0;border-bottom-color:#d7d3dc}
.board .place-heading{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;min-width:0;min-height:0;padding:3px 0;color:#82748f;font-weight:600;font-size:clamp(7px,calc(var(--square,50px)*.18),9.5px);line-height:1.15;text-align:center;z-index:1}
.board .place-heading.active-place{background:#eee8fa;color:var(--purple-dark)}
.board.vertical-headings .place-heading{flex-direction:row;gap:2px;padding:3px 0;font-size:clamp(7px,calc(var(--square,35px)*.25),10px)}
.board.vertical-headings .place-heading span{writing-mode:vertical-rl;transform:rotate(180deg)}
.board .decimal-point{display:flex;align-items:center;justify-content:center;font-size:clamp(16px,calc(var(--square,50px)*.68),35px);font-weight:700;line-height:1;z-index:2;color:var(--purple-dark)}
.keypad-targets{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 36px}
.keypad-targets #decimal-key{font-size:22px;line-height:16px;color:var(--purple);background:var(--lavender);padding:0}
.board .carry-digit{width:calc(var(--square,50px)*.54);height:calc(var(--square,50px)*.54);font-size:clamp(8px,calc(var(--square,50px)*.34),17px)}
.board .carry-digit.below-carry{height:calc(var(--square,50px)*.44);max-height:none;font-size:clamp(8px,calc(var(--square,50px)*.29),15px)}
.board .carry-digit.carry-active{background:#ffe999;border-color:#d9ba4a;color:#735414;opacity:1}
/* Keep a long decimal equation within the available width. */
.equation{min-width:0;max-width:100%;font-size:clamp(16px,2.6vw,26px);gap:clamp(5px,1vw,12px)}
.complete-result{max-width:100%;font-size:clamp(20px,3vw,33px)}
@media(max-width:760px){.compact-ui .equation{font-size:clamp(12px,3.7vw,20px);gap:5px}.compact-ui .equation-answer{min-width:0;padding-inline:6px}.compact-ui .complete-result{font-size:26px}}

/* The place-value chart generator supplies these header colours. */
.board .place-heading{background:var(--place-colour);color:#153d3b}
.board .place-heading.active-place{background:var(--place-colour);color:#153d3b;box-shadow:inset 0 -3px 0 var(--purple)}
.board .number-token{position:relative;isolation:isolate;overflow:visible;font-variant-numeric:tabular-nums}
.number-token .units-value{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.number-token .borrowed-one{position:absolute;left:2%;top:8%;font-size:.55em;line-height:1;color:#e34a2b;font-weight:700}
.board .number-token.is-crossed{color:#9787aa;background:transparent;border-color:transparent}
.board .number-token.is-crossed:after{content:'';position:absolute;top:49%;left:12%;width:76%;height:2px;border-radius:2px;background:#e34a2b;transform:rotate(38deg);z-index:3}
.board .number-token.donor-active{background:var(--lavender);border-color:var(--purple);color:var(--purple)}
.board .number-token.receiving-value{background:#fff3ac;border-color:#cfad2f}
.board .replacement-digit{display:flex;align-items:center;justify-content:center;align-self:end;justify-self:center;width:calc(100% - 5px);height:calc(var(--square,50px)*.65);margin-bottom:3px;border:1px solid transparent;border-radius:5px;font-size:clamp(12px,calc(var(--square,50px)*.43),23px);font-weight:600;line-height:1;color:#6c537e;z-index:4}
.board .replacement-digit.current-value{background:var(--yellow);border-color:#cfad2f;color:var(--ink)}
.board .replacement-digit.fresh-replacement{background:var(--lavender);border-color:#b9a6db;animation:pop .3s ease-out}
.board .replacement-digit .borrowed-one{left:5%;top:10%}
.board .receiving-value .borrowed-one{animation:borrow-appear .4s ease-out}
.board .digit.placeholder-zero{color:#8e7a9d}
.board .digit.placeholder-zero.multiplier-active{color:white}
.answer-wrap.during-exchange{visibility:hidden;pointer-events:none}
@keyframes borrow-appear{from{opacity:0;transform:translateY(-8px) scale(1.4)}to{opacity:1;transform:translateY(0) scale(1)}}

/* Guided actions occupy the answer slot, with the keypad kept in place. */
.guided-action{align-self:flex-start;max-width:270px;width:100%;height:46px;min-height:46px;padding:6px 10px;font-size:12px;white-space:normal;line-height:1.25}
.board .decimal-zero-target{background:var(--lavender);border-color:var(--purple)}
.compact-ui .guided-action{align-self:center;max-width:310px;height:44px;min-height:44px}
@media(max-height:600px) and (min-width:540px){.compact-ui .guided-action{height:35px;min-height:35px;font-size:11px}}

/* A click starts the exchange: cross out, move the 1, then show the new value. */
.board .exchange-landing{visibility:hidden;pointer-events:none}
.board .exchange-flight{position:absolute;left:0;top:0;display:flex;align-items:center;justify-content:center;width:.6em;height:1em;font-weight:700;line-height:1;color:#e34a2b;z-index:12;pointer-events:none;transform-origin:center;animation:exchange-transfer .85s cubic-bezier(.45,0,.2,1) forwards}
.board .fresh-cross:after{transform-origin:left center;animation:draw-exchange .25s ease-out}
@keyframes draw-exchange{from{transform:rotate(38deg) scaleX(0)}to{transform:rotate(38deg) scaleX(1)}}
@keyframes exchange-transfer{from{transform:translate(var(--exchange-from-x),var(--exchange-from-y)) scale(var(--exchange-scale))}to{transform:translate(var(--exchange-to-x),var(--exchange-to-y)) scale(1)}}
@media(prefers-reduced-motion:reduce){.board .exchange-flight{transform:translate(var(--exchange-to-x),var(--exchange-to-y))}}
