:root{font-family:ui-sans-serif,system-ui,-apple-system,sans-serif;color:#253e36;background:#f4f3ec;--green:#1c5948}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0}button,input{font:inherit;-webkit-tap-highlight-color:transparent}button{cursor:pointer;border:0}:focus-visible{outline:3px solid #d3933d;outline-offset:3px}main{height:100dvh;min-height:320px;padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}.workspace{height:100%;display:flex;flex-direction:column;background:#fffef9;border:1px solid #dcded4;border-radius:14px;overflow:hidden}.readout{flex:0 0 56px;padding:4px 16px;display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid #e3e6d8}output{font-size:clamp(26px,4vw,40px);font-variant-numeric:tabular-nums;letter-spacing:1px}.controls{display:flex;gap:4px}.quiet{background:transparent;color:#526259;padding:8px 12px;min-height:44px;font-size:20px;border-radius:8px}.quiet span{font-size:13px}.quiet{display:inline-flex;align-items:center;justify-content:center;gap:6px}.icon{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.lock-control .icon rect{fill:currentColor;stroke:none}.lock-control .shackle{transition:transform .18s ease}.lock-control[aria-pressed=true]{color:#a8681f}.lock-control[aria-pressed=true] .shackle{transform:translate(4.5px,-1.5px) rotate(18deg);transform-origin:15.5px 10.5px}.quiet:hover{background:#e8eddf}.board-wrap{flex:1;min-height:0;display:flex;flex-direction:column;padding:4px 8px 8px;background:radial-gradient(ellipse at center,#f5f5eb,#e9ecdf)}.labels,.digits{display:grid;grid-template-columns:repeat(6,1fr);margin:0 3.333%;text-align:center}.labels{flex:0 0 44px}.labels small{display:block;font-size:.8em;margin-top:2px;opacity:.75}.board-stage{position:relative;flex:1;min-height:0}#board{display:block;width:100%;height:100%;touch-action:none;-webkit-user-select:none;user-select:none;overflow:visible}.digits{flex:0 0 28px;align-items:center;color:#77846b;font-size:18px;font-variant-numeric:tabular-nums}.digits span{position:relative}.digits .active{color:var(--green);font-weight:700}.point{position:absolute;right:-4px;color:#b37435}.decimal-slider{position:absolute;top:34.359%;left:0;width:100%;height:32px;transform:translateY(-50%);pointer-events:none}#decimal{appearance:none;-webkit-appearance:none;position:absolute;left:calc(11.111% - 16px);width:calc(77.778% + 32px);height:32px;margin:0;background:transparent;pointer-events:auto;touch-action:none;cursor:ew-resize}#decimal::-webkit-slider-runnable-track{height:32px;background:transparent}#decimal::-moz-range-track{height:32px;background:transparent}#decimal::-webkit-slider-thumb{appearance:none;width:32px;height:32px;background:#efbc70;clip-path:polygon(15% 26%,85% 26%,50% 72%)}#decimal::-moz-range-thumb{border:0;border-radius:0;width:32px;height:32px;background:#efbc70;clip-path:polygon(15% 26%,85% 26%,50% 72%)}.bead{cursor:grab;outline:none}.bead:active{cursor:grabbing}.bead-face{fill:url(#bead-idle);stroke:#9eaa84;stroke-width:.8}.bead.active .bead-face{fill:url(#bead-on);stroke:#1c4632}.bead.held .bead-face{fill:url(#bead-held);stroke:#4d7046}.bead:focus-visible .bead-face{stroke:#d3933d;stroke-width:3}.bead-turn{fill:url(#bead-turn);pointer-events:none}.bead-shadow{fill:#2e4527;opacity:.13}.bead .ridge{stroke:#fbfcf2;stroke-width:1;opacity:.32;stroke-linecap:round}.bead.active .ridge{stroke:#b8dcb9;opacity:.35}.bead .shine{fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round;opacity:.55}.bead.active .shine{opacity:.3}.rod{stroke:#a4b090;stroke-width:4;stroke-linecap:round}.rail-shadow{stroke:#c8d0b9;stroke-width:8;opacity:.35}.count-bar{fill:url(#beam)}.count-bar-edge{stroke:#4f7d6b;stroke-width:1;opacity:.6}.frame{fill:url(#beam);opacity:.92}.marker{fill:#d4dab1}dialog{width:min(440px,calc(100% - 32px));max-height:calc(100dvh - 32px);overflow-y:auto;border:1px solid #dce0d1;border-radius:18px;padding:24px;background:#fffef7;color:#344e3f;line-height:1.6;box-shadow:0 20px 100px #10291b40}dialog::backdrop{background:#182c2360;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}dialog h2{font:28px Georgia,serif;margin:12px 0 24px}dialog p{font-size:14px}.close{float:right}.setting-row{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid #dfe5d6}.toggle{border-radius:20px;padding:10px 16px;min-width:80px;min-height:44px;background:#e8ecdf;color:#4c6253}.toggle[aria-pressed=true]{background:var(--green);color:#fff}#motion-status{color:#66745d;font-size:13px}summary{cursor:pointer;padding:12px 0}details p{margin-top:0}#show-welcome{font-size:13px;padding-left:0}.brand{font:700 36px Georgia,serif;letter-spacing:-1.5px;margin:10px 0 24px}.brand-icon{display:inline-flex;align-items:center;justify-content:center;font-family:monospace;background:var(--green);color:#f1e9cb;width:34px;height:34px;border-radius:9px;font-size:32px;margin-right:10px}.brand-dot{color:#cb9754}.primary{color:#fffef4;background:var(--green);padding:12px 22px;border-radius:9px;min-height:44px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media(orientation:landscape){main{min-height:0;padding-top:max(4px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom))}.workspace{flex-direction:row}.readout{order:1;flex:0 0 clamp(100px,12vw,130px);flex-direction:column;justify-content:space-between;padding:14px 8px;border-bottom:0;border-left:1px solid #dce2d1}output{font-size:clamp(18px,2.4vw,26px);letter-spacing:0;white-space:nowrap}.controls{flex-direction:column;gap:12px;width:100%}.controls .quiet{min-height:48px;width:100%;background:#edf0e5}.board-wrap{min-width:0;padding:4px 8px}.board-stage{order:0}.digits{order:1;flex-basis:22px;font-size:15px}.labels{order:2;flex-basis:44px;display:none}.labels small{display:none}.bead-face,.bead-turn{transform:scaleY(1.05)}.bead-shadow{transform:translate(1.5px,3.5px) scaleY(1.05)}}.labels>span{display:flex;flex-direction:column;justify-content:center;color:#738067;font-size:clamp(8px,1.6vw,13px);padding:2px;overflow-wrap:anywhere}.labels>span.selected{color:var(--green);font-weight:750}#decimal{pointer-events:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.decimal-gesture{position:absolute;inset:0;pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:default}#decimal.unlocked+.decimal-gesture{cursor:ew-resize}.lock-control[aria-pressed=true]{background:#f6ecd6}#decimal.unlocked::-webkit-slider-thumb{background:#fff1c3;transform:scale(1.35)}#decimal.unlocked::-moz-range-thumb{background:#fff1c3;transform:scale(1.35)}.setting-note{color:#66745d;font-size:13px;margin:12px 0 0}.setting-row[hidden],.problem-note[hidden],.problem-step[hidden]{display:none}.segmented{display:flex;gap:6px}.segmented .toggle{min-width:52px;font-size:18px}select{border-radius:10px;border:1px solid #dfe5d6;background:#fffef7;color:#344e3f;padding:10px 12px;min-height:44px;font:inherit}@media(max-width:420px){.setting-row{flex-wrap:wrap;gap:8px}.setting-row select{flex:1 0 100%;min-width:0}}body.testing #decimal-lock,body.testing #reset span{display:none}body.testing .controls .action{background:#edf0e5;font-size:15px;padding:8px 14px}body.testing .controls .submit{background:var(--green);color:#fffef4}body.testing .controls .submit:hover{background:#174b3c}.problem-lines{font-size:clamp(24px,6vw,34px);line-height:1.4;text-align:right;font-variant-numeric:tabular-nums;padding:2px 10px}.problem-lines.wide{font-size:clamp(17px,3.6vw,22px);line-height:1.3}.problem-lines .rule{border-top:2px solid #e3e6d8;margin-top:6px;padding-top:6px}.problem-note{color:#66745d;font-size:14px;margin:16px 0 0}.problem-lines .line{display:block;width:100%;font:inherit;font-variant-numeric:inherit;color:inherit;text-align:right;background:none;border:0;padding:0;border-radius:8px}.problem-lines .line.steppable{cursor:pointer}.problem-lines .line.marked{background:#e8ecdf;box-shadow:inset -3px 0 #cb9754}.problem-lines .line:focus-visible{outline:2px solid var(--green);outline-offset:2px}.problem-step{color:#66745d;font-size:14px;margin:12px 0 0}.problem-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:20px}.problem-actions button{border-radius:9px;padding:10px 16px;min-height:44px;background:#e8ecdf;color:#4c6253}.problem-actions button.primary{background:var(--green);color:#fffef4}.decimal-slider[data-hint]:after{content:attr(data-hint);position:absolute;left:clamp(64px,var(--caret-left),calc(100% - 64px));top:-30px;transform:translate(-50%);padding:4px 9px;border-radius:6px;background:#183e36;color:#fff4d5;font-size:12px;white-space:nowrap;pointer-events:none}.setting-group h3{font-size:12px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:#7d8b71;margin:22px 0 2px}.setting-group:first-of-type h3{margin-top:16px}.pill{border-radius:20px;padding:10px 16px;min-width:80px;min-height:44px;background:#e8ecdf;color:#4c6253}.pill:hover,.toggle:hover{filter:brightness(.97)}.sheet-note{color:#66745d;font-size:14px;margin:0 0 12px}.sheet-list{list-style:none;margin:0;padding:0;max-height:min(440px,calc(100dvh - 272px));overflow-y:auto}.sheet-item{display:flex;align-items:baseline;gap:10px;padding:8px 6px;border-bottom:1px solid #e6e9dc;border-radius:6px}.sheet-item:nth-child(2n){background:#f3f5ed}.sheet-item:last-child{border-bottom:0}.sheet-index{flex:0 0 1.6em;text-align:right;color:#61745a;font-size:15px;font-weight:700;font-variant-numeric:tabular-nums}.sheet-problem{flex:1;padding:4px 8px;border-radius:8px;background:none;color:inherit;text-align:right;font-size:clamp(17px,4.4vw,22px);line-height:1.35;font-variant-numeric:tabular-nums}.sheet-problem:hover{background:#f1f3e8}.sheet-line{display:block}.sheet-total{display:block;margin-top:5px;padding-top:5px;border-top:2px solid #e3e6d8;color:var(--green);font-weight:700}@media print{main,#settings-dialog,#welcome-dialog,#problem-dialog,#tutorial-dialog{display:none!important}#worksheet-dialog{position:static;width:auto;max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;background:#fff;color:#000;box-shadow:none;overflow:visible}#worksheet-dialog::backdrop{display:none}#worksheet-dialog .close,#sheet-actions,#sheet-note{display:none}#worksheet-dialog h2{font-size:19px;margin:0 0 10px}.sheet-list{max-height:none;overflow:visible;columns:2;column-gap:28px}.sheet-item{break-inside:avoid;page-break-inside:avoid;background:transparent}.sheet-problem{padding:0;font-size:15px}.sheet-problem:hover{background:none}.sheet-total{border-top-color:#999}}.tutorial-dialog{width:min(620px,calc(100% - 24px));max-height:calc(100dvh - 24px);padding:clamp(16px,4vw,28px)}.tutorial-kicker{margin:4px 0;color:#8c9a7a;font-size:11px;letter-spacing:2px;font-weight:800}.tutorial-dialog h2{margin:4px 0 10px}.tutorial-operations{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-bottom:8px}.tutorial-operation{min-height:44px;border-radius:10px;background:#f0f2e8;color:#526259;font-size:13px}.tutorial-operation.selected{background:var(--green);color:#fffef4}.tutorial-lesson-nav{display:flex;gap:8px;margin:0 0 12px}.lesson-number{width:44px;height:44px;border-radius:50%;background:#edf0e5;color:#64715e;font-size:12px}.lesson-number.selected{background:#d4dfc9;color:#214d3c;font-weight:800;box-shadow:inset 0 0 0 2px #79936e}.lesson-meta{display:flex;justify-content:space-between;align-items:center;color:#849078;font-size:13px;min-height:24px}.lesson-feedback{font-size:22px;color:#c3cbb3}.lesson-feedback.success{color:#347953}.lesson-title{margin:4px 0 10px;font:700 21px Georgia,serif}.lesson-equation{display:flex;justify-content:center;align-items:center;gap:clamp(8px,3vw,20px);padding:8px 0 12px;color:#263f35;font-size:clamp(25px,8vw,42px);font-variant-numeric:tabular-nums}.equation-part.operator{color:#9a7947}.lesson-prompt{margin:0 0 3px;text-align:center;color:#76836e;font-size:13px}.lesson-legend{margin:10px 0 4px;text-align:center;color:#71806e;font-size:12px}.lesson-legend strong{color:#2e493a}.legend-counted{white-space:nowrap}.legend-counted i{display:inline-block;width:14px;height:9px;margin:0 4px 0 2px;border-radius:3px;background:#39785b;vertical-align:middle}.lesson-abacus{width:min(440px,100%);margin:8px auto 0;padding:8px 10px 5px;border:1px solid #d8dfd0;border-radius:14px;background:linear-gradient(180deg,#f6f6ed,#e9eddf)}.lesson-upper-row,.lesson-lower-row{--rod:#a4b090;background:linear-gradient(to right,transparent calc(16.667% - 2px),var(--rod) calc(16.667% - 2px),var(--rod) calc(16.667% + 2px),transparent calc(16.667% + 2px),transparent calc(50% - 2px),var(--rod) calc(50% - 2px),var(--rod) calc(50% + 2px),transparent calc(50% + 2px),transparent calc(83.333% - 2px),var(--rod) calc(83.333% - 2px),var(--rod) calc(83.333% + 2px),transparent calc(83.333% + 2px))}.lesson-place-row,.lesson-upper-row,.lesson-lower-row{display:grid;grid-template-columns:repeat(3,1fr);justify-items:center;align-items:center}.lesson-place-row{height:22px;color:#86927c;font-size:10px;letter-spacing:.3px}.lesson-upper-row,.lesson-lower-row{height:48px}.lesson-bead{position:relative;width:clamp(44px,13vw,72px);height:44px;border-radius:8px;background:#d1d6bb;box-shadow:inset 0 1px 2px #fff8,0 2px 3px #263f3520;transition:background .28s ease,box-shadow .28s ease,transform .28s ease}.lesson-bead:after{content:"";position:absolute;left:44%;top:21px;width:12%;height:2px;border-radius:2px;background:#9caa8e}.lesson-bead.active{background:#39785b;box-shadow:inset 0 1px 2px #bcd9a1}.lesson-bead.active:after{background:#a8cd93}.lesson-upper-row .lesson-bead.active{transform:translateY(5px)}.lesson-lower-row .lesson-bead.active{transform:translateY(-5px)}.lesson-bar{height:8px;margin:1px -10px 2px;background:#1e4439;box-shadow:0 1px 2px #183e3640}.lesson-digits{display:grid;grid-template-columns:repeat(3,1fr);margin-top:5px;text-align:center;color:#52675a;font-size:17px;font-variant-numeric:tabular-nums}.lesson-controls{display:flex;justify-content:space-between;gap:10px;margin-top:12px}.lesson-controls button{min-height:44px;padding:8px 12px;border-radius:10px;background:#edf0e5;color:#4c6253}.lesson-controls .primary{background:var(--green);color:#fffef4}.lesson-controls .lesson-reset{width:48px;border-radius:10px;background:#edf0e5;color:#4c6253;font-size:23px}.lesson-next:disabled{background:#dfe4d5;color:#738067;cursor:not-allowed}.lesson-complete{padding:24px 0;text-align:center}.lesson-review{min-height:44px;margin-top:10px;padding:10px 16px;border-radius:10px;background:#edf0e5;color:#4c6253}.lesson-badges{display:flex;justify-content:center;gap:12px;margin:22px 0}.lesson-badge{display:grid;place-items:center;width:56px;height:56px;border-radius:50%;background:#edf1e5;color:#1c5948;font-size:24px;font-weight:700}.lesson-badge.done{background:#dcebd7}@media(max-width:420px){.tutorial-operations{gap:4px}.tutorial-operation{font-size:12px}.lesson-bead{width:clamp(42px,13vw,56px)}}.lesson-story{margin:6px 0 8px;color:#41584b;font-size:14px;line-height:1.55}.lesson-board-role{margin:0 0 10px;padding:9px 11px;border-left:3px solid #79936e;border-radius:0 8px 8px 0;background:#f1f4e9;color:#536650;font-size:13px;line-height:1.5}.lesson-step-card{padding:12px 14px;border:1px solid #dce3d2;border-radius:12px;background:#f8f8f0}.lesson-step-card p{margin:0}.lesson-step-counter{color:#819078;font-size:11px!important;font-weight:800;letter-spacing:.7px;text-transform:uppercase}.lesson-step-action{margin-top:5px!important;color:#2e493a;font-size:15px!important;font-weight:700;line-height:1.45}.lesson-step-why{margin-top:6px!important;color:#5d6e5c;font-size:13px!important;line-height:1.5}.lesson-counter{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin:10px 0;padding:10px 12px;border-radius:10px;background:#edf1e5;color:#405746;font-size:14px}.lesson-counter-value{font-variant-numeric:tabular-nums}.lesson-count-controls{display:flex;flex-wrap:wrap;gap:6px}.lesson-count-controls[hidden]{display:none}.lesson-count-move{min-height:40px;padding:7px 10px;border-radius:9px;background:#fffef7;color:#3c6049;font-size:13px;font-weight:650}.lesson-count-move:disabled{opacity:.5;cursor:not-allowed}.lesson-prompt{text-align:left!important;color:#65745d!important;line-height:1.45}.lesson-show[hidden],.lesson-prompt[hidden],.lesson-step-why:empty{display:none}
