:root{--navy:#1d3d69;--ink:#213653;--muted:#63748a;--blue:#3974c6;--blue-soft:#e4edfa;--lime:#c3e888;--coral:#e98d64;--paper:#f5f5ee;--line:#dce2e7}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.5 'Avenir Next','Segoe UI',Arial,sans-serif}button,input,select{font:inherit}button{cursor:pointer;border:0}button:disabled{opacity:.35;cursor:default}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #b65d35;outline-offset:3px}a{color:inherit}.skip{position:absolute;left:-9999px}.skip:focus{left:12px;top:12px;background:white;padding:12px;z-index:20}header{display:flex;align-items:center;justify-content:space-between;padding:14px 4.5%;border-bottom:1px solid var(--line)}.brand{display:flex;gap:9px;align-items:center;text-decoration:none;font-size:14px;font-weight:800}.brand b{display:grid;place-items:center;background:var(--navy);color:white;width:36px;height:36px;border-radius:10px;font-size:18px}.shell{max-width:1340px;padding:27px 5% 0;margin:auto}.heading,.title,.top-actions{display:flex;align-items:center}.heading{justify-content:space-between;gap:20px;margin-bottom:24px}.title{gap:15px}h1{font-size:clamp(32px,4vw,48px);letter-spacing:-.055em;line-height:1.1;margin:0}h2,p{margin:0}.title p{color:var(--muted);font-size:15px;margin-top:5px}.brand-array{display:grid;grid-template-columns:repeat(3,9px);gap:5px;transform:rotate(-9deg)}.brand-array i{width:9px;height:9px;background:var(--blue);border-radius:50%}.brand-array i:nth-child(n+4){background:var(--coral)}.top-actions{gap:8px}.primary,.quiet,.chip,.icon-button{border-radius:12px;padding:10px 15px;min-height:44px;font-weight:750;white-space:nowrap}.primary{background:var(--navy);color:white}.primary:hover:not(:disabled){background:#2d5484}.quiet{background:#fff;color:var(--ink);border:1px solid var(--line)}.quiet:hover:not(:disabled){background:var(--blue-soft)}.text-button{background:none;font-weight:700;color:var(--muted);font-size:14px;padding:9px}.workspace{background:white;border:1px solid var(--line);border-radius:25px;box-shadow:0 10px 35px #21365308;overflow:hidden}.workspace-top{display:flex;align-items:center;gap:11px;flex-wrap:wrap;padding:18px 24px;border-bottom:1px solid var(--line);background:#fcfcfa}.stepper{display:flex;gap:0;align-items:center}.stepper label{font-size:13px;font-weight:800;color:var(--muted);margin-right:10px}.stepper button{background:var(--blue-soft);color:var(--navy);width:34px;height:38px;font-weight:800;border-radius:9px;font-size:19px}.stepper input{width:47px;text-align:center;border:0;background:transparent;font-size:24px;color:var(--navy);font-weight:800;appearance:textfield;-moz-appearance:textfield}.stepper input::-webkit-inner-spin-button{appearance:none}.times{font-size:22px;color:#a7b2c3}.array-actions{margin-left:auto;display:flex;gap:8px}.array-actions button{font-size:14px;min-height:40px;padding:8px 12px}.prompt{text-align:center;margin:23px auto 5px;padding:0 25px;font-size:20px;font-weight:650;overflow-wrap:anywhere}.prompt:empty{display:none}.array-frame{max-width:800px;margin:20px auto 24px;padding:0 45px 0 20px}.dimension{font-size:14px;font-weight:750;color:var(--muted)}.top-dimension{text-align:center;margin:0 0 13px 45px}.array-middle{display:flex;align-items:center;gap:18px;min-height:200px}.side-dimension{writing-mode:vertical-rl;transform:rotate(180deg);flex-shrink:0;letter-spacing:.02em}.array-surface{flex:1;min-width:0;display:flex;align-items:center;justify-content:center}#array{display:grid;gap:clamp(3px,1vw,10px);width:min(100%,var(--array-width));padding:3px;align-items:center;justify-items:center}#array[hidden]{display:none}.counter{position:relative;display:grid;place-items:center;width:100%;aspect-ratio:1;max-width:54px;font-size:clamp(11px,2.1vw,24px);font-weight:800;line-height:1;color:white}.counter.dots{border-radius:50%;background:var(--counter-color);box-shadow:inset 0 -4px 0 #00000013}.counter.tiles{border-radius:12%;background:var(--counter-color);box-shadow:inset 0 -4px 0 #00000016}.counter.stars{color:var(--counter-color)}.counter.stars svg{width:100%;height:100%;fill:currentColor}.counter.apples{font-size:clamp(15px,4vw,48px)}.counter .counter-number{position:absolute;inset:0;display:grid;place-items:center;text-shadow:0 1px 3px #0009}.counter.stars .counter-number{color:#1d3154;text-shadow:none;font-size:.8em}.counter.apples .counter-number{font-size:.45em;color:white;text-shadow:0 1px 4px #000}.counter-spacer{height:100%;width:100%;border-left:2px dashed #c5ccd5;justify-self:center;transform:translateX(50%)}#empty{padding:45px;text-align:center;color:var(--muted);font-size:23px}.workspace-bottom{display:flex;align-items:center;gap:15px;padding:16px 24px;border-top:1px solid var(--line);background:#fcfcfa;flex-wrap:wrap}.chip{border:1px solid var(--line);background:white;color:var(--ink);font-size:14px;min-height:40px}.chip[aria-pressed=true]{background:var(--blue-soft);border-color:var(--blue);color:var(--navy)}#splitControls{display:flex;align-items:center;gap:12px;font-size:13px;color:var(--muted)}#splitControls[hidden]{display:none}#cutValue{font-weight:850;color:var(--navy)}#cut{accent-color:var(--blue);width:110px}.total{margin-left:auto;font-size:15px;font-weight:750;background:#edf5e3;color:#395329;padding:6px 13px;border-radius:30px}.representations{display:grid;grid-template-columns:1fr 1.2fr 1fr;gap:12px;margin-top:18px}.math-card{background:white;border:1px solid var(--line);border-radius:20px;padding:20px 22px;min-width:0}.math-card.multiply{background:var(--navy);color:white;border-color:var(--navy)}.math-label{font-size:10px;letter-spacing:.11em;font-weight:850;color:var(--muted)}.multiply .math-label{color:#d1dfef}.equation{font-size:clamp(28px,3vw,40px);letter-spacing:-.04em;font-weight:800;margin:6px 0;line-height:1.3}.addition-equation{font-size:clamp(19px,2vw,27px);font-weight:750;line-height:1.45;margin:12px 0;overflow-wrap:anywhere}.division-equation{font-size:22px;font-weight:750;line-height:1.6;margin:8px 0;white-space:pre-line}.math-card small{font-size:12px;color:var(--muted)}.multiply small{color:#d1dfef}.split-math{margin-top:15px;padding:22px;background:#fff8ed;border:1px solid #ecd5b5;border-radius:20px;text-align:center}.split-math[hidden]{display:none}#splitEquation{font-size:clamp(20px,2.3vw,30px);font-weight:800;color:var(--navy);margin:8px 0}#partialProducts{font-size:23px;font-weight:700;color:#8b461f}footer{display:flex;justify-content:space-between;gap:15px;padding:23px 0;font-size:12px;color:var(--muted)}footer>div{display:flex;align-items:center;gap:15px}dialog{border:1px solid var(--line);border-radius:24px;padding:0;color:var(--ink);background:var(--paper);width:min(490px,94vw);max-height:90dvh;box-shadow:0 30px 80px #10233955}dialog::backdrop{background:#162e4ebd;backdrop-filter:blur(5px)}.dialog-content{padding:30px}.dialog-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.dialog-top h2{font-size:28px;letter-spacing:-.04em}.icon-button{font-size:25px;padding:3px 12px;background:none;color:var(--ink)}.field{display:block;font-size:14px;font-weight:750;margin:18px 0}.field span{color:var(--muted);font-weight:400}.field input,.field select{display:block;width:100%;padding:11px;border:1px solid #c5cfdb;border-radius:11px;color:var(--ink);background:white;margin-top:7px;min-height:45px}.check{display:flex;align-items:center;gap:10px;font-size:14px}.check input{width:19px;height:19px;accent-color:var(--navy)}.dialog-bottom{display:flex;justify-content:space-between;margin:28px 0 16px}.dialog-content>small{display:block;font-size:11px;color:var(--muted);text-align:center}.welcome{text-align:center;padding:34px}.mini-array{display:grid;grid-template-columns:repeat(4,15px);gap:9px;justify-content:center;margin-bottom:24px}.mini-array i{width:15px;height:15px;background:var(--blue);border-radius:50%}.mini-array i:nth-child(n+9){background:var(--coral)}.eyebrow{font-size:11px;font-weight:800;letter-spacing:.12em;color:var(--blue)}.welcome h2{font-size:40px;line-height:1.05;letter-spacing:-.055em;margin:10px 0 25px}.how-steps{display:grid;gap:19px;text-align:left;margin-bottom:26px}.how-steps>div{display:flex;align-items:center;gap:12px}.how-steps b{display:grid;place-items:center;flex-shrink:0;width:33px;height:33px;background:var(--blue-soft);border-radius:50%;color:var(--navy)}.how-steps strong{display:block;font-size:16px;color:var(--ink)}.how-steps span{font-size:13px;color:var(--muted)}.wide{width:100%;margin-bottom:15px}.toast{position:fixed;left:50%;bottom:15px;transform:translateX(-50%);background:var(--navy);color:white;border-radius:12px;padding:12px 18px;font-size:14px;z-index:80;max-width:90vw}#saveWarning{position:fixed;bottom:0;left:0;right:0;padding:10px;background:#fff0cb;color:#6b4000;text-align:center;font-size:13px;z-index:90}body.display header,body.display footer,body.display #project{display:none}body.display .shell{max-width:1500px;padding-top:18px}body.display .heading{margin-bottom:17px}body.display .title h1{font-size:34px}body.display .title p{display:none}body.display .array-frame{max-width:950px}body.display .counter{max-width:65px}body.expanded{position:fixed;inset:0;overflow:auto;z-index:50}body.expanded header{display:none}body.expanded .shell{max-width:1500px}@media(max-width:850px){.heading{align-items:flex-start;flex-direction:column;gap:18px}.top-actions{flex-wrap:wrap}.workspace-top{padding:15px;gap:9px}.array-actions{width:100%;margin:8px 0 0;justify-content:flex-end}.representations{grid-template-columns:1fr 1fr}.math-card:last-child{grid-column:1/-1}.division-equation{white-space:normal}.workspace-bottom{padding:14px}.array-frame{padding:0 20px 0 14px}.prompt{font-size:18px}.top-dimension{margin-left:30px}.array-middle{gap:10px}.counter{font-size:clamp(9px,2.7vw,20px)}.counter.apples{font-size:clamp(12px,5vw,40px)}footer{flex-direction:column}#splitControls{flex-wrap:wrap}}@media(max-width:460px){.shell{padding:22px 4% 0}.top-actions{width:100%}.top-actions button{flex:1;font-size:13px;padding:8px 11px}.stepper label{margin-right:6px;font-size:12px}.stepper input{width:34px;font-size:22px}.stepper button{width:29px}.workspace-top{gap:6px}.array-actions{justify-content:space-between;gap:5px}.array-actions button{font-size:12px;flex:1;padding:8px}.representations{grid-template-columns:1fr}.math-card:last-child{grid-column:auto}.math-card{padding:18px 20px}.workspace-bottom{gap:10px}.total{font-size:13px}#splitControls{order:3;width:100%;justify-content:center}.brand-array{display:none}.counter{box-shadow:none!important}.array-middle{min-height:150px}.array-frame{margin-top:15px}.dimension{font-size:12px}.prompt{font-size:16px}.counter-number{font-size:.75em}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}@media print{header,.top-actions,.workspace-top button,.workspace-bottom button,#splitControls,footer,dialog,.toast,#saveWarning{display:none!important}body{background:white}.shell{padding:0}.workspace{box-shadow:none;break-inside:avoid}.math-card,.split-math{break-inside:avoid}.representations{grid-template-columns:1fr 1fr 1fr}.counter{-webkit-print-color-adjust:exact;print-color-adjust:exact}.math-card.multiply{background:white;color:var(--ink)}.math-card.multiply small,.multiply .math-label{color:var(--muted)}.stepper input{width:40px}.workspace-top{justify-content:center}.array-frame{max-width:600px}}
.counter.apples{background:color-mix(in srgb,var(--counter-color) 13%,transparent);border-radius:12px}.counter{max-width:clamp(12px,calc((100dvh - 420px)/var(--rows) - 9px),54px)}body.display .counter{max-width:clamp(12px,calc((100dvh - 390px)/var(--rows) - 9px),65px)}@media(max-width:460px){.counter{max-width:54px}}@media print{.counter,body.display .counter{max-width:45px}}

.math-label{font-size:12px}.math-card small{font-size:14px}.dimension{font-size:16px}@media(max-width:460px){.dimension{font-size:13px}}

.mode-links{display:flex;flex-wrap:wrap;gap:7px;margin:0 0 16px}
.mode-links a{padding:8px 13px;border-radius:10px;font-weight:750;text-decoration:none}
.mode-links a:hover{background:white}
.mode-links [aria-current=page]{background:var(--blue-soft);color:var(--navy)}
[hidden]{display:none!important}
.display .mode-links,.display #share{display:none}
@media print{.mode-links,#share{display:none!important}}
@media(max-width:550px){.array-actions{flex-wrap:wrap}}
