:root{color-scheme:light;--ink:#203c36;--muted:#4f675e;--green:#285846;--line:#cad8c9;--cream:#f4f6ef;--rust:#97451f;font:100%/1.42 system-ui,-apple-system,sans-serif;color:var(--ink);background:var(--cream)}
*{box-sizing:border-box}body,h1,h2,p,figure,ol{margin:0}body>header,main{margin-inline:auto;padding-inline:clamp(.7rem,2.5vw,1.8rem)}body>header{max-width:74rem}
header{display:flex;align-items:center;justify-content:space-between;gap:.6rem;min-height:3.25rem}header nav,.section-head,.symbols,.input-tools{display:flex;align-items:center;gap:.4rem;flex-wrap:wrap}
header a,.text-button{color:var(--green);font-weight:650}header nav button[aria-pressed=true]{background:#e3ebdd;border-color:#627f69}
a,button,input,select,summary{font:inherit}button,select{min-height:44px;min-width:0;max-width:100%;border:1px solid #a9bbab;border-radius:.58rem;background:white;color:var(--ink);padding:.45rem .72rem}
button,summary{cursor:pointer;touch-action:manipulation}button:hover{background:#eff4ed}button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible,summary:focus-visible,figure:focus-visible{outline:3px solid #a54e23;outline-offset:2px}
.balance-trainer main{width:100%;max-width:52rem;padding-block:.6rem 1.5rem}h1{font-size:clamp(1.55rem,3.1vw,2.25rem);line-height:1.12;letter-spacing:-.035em}h2{font-size:1.06rem;line-height:1.23}.heading p,.guide{color:var(--muted)}.heading{margin-bottom:.6rem}.heading p{margin-top:.16rem}
.workbench{display:grid;grid-template-columns:minmax(0,1fr);gap:.55rem}.worksheet,.scale-card,.history,.options{min-width:0;padding:clamp(.65rem,1.45vw,1rem);border:1px solid var(--line);border-radius:.85rem;background:white}
.scale-card{background:#f8faf4;scroll-margin-top:3.5rem}.section-head{justify-content:space-between;gap:.2rem .5rem}.section-head button{font-size:.875rem}
#scale-state{color:#425e4d;font-size:.9rem;font-weight:650}.scale-card:not([data-balance=level]) #scale-state{color:#814423}
.scale-picture{width:min(100%,29rem);margin-inline:auto}.scale-picture svg{display:block;max-height:10.8rem;width:100%;height:auto;overflow:visible}
.scale-picture .group-layout{max-height:14rem}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.model-choice{min-width:0;max-width:100%}.model-choice select{font-weight:650;color:var(--green);min-height:44px;background-color:#f0f5eb;border-color:#b6cbb9}
.custom-row{display:flex;gap:.4rem;flex-wrap:wrap}.custom-row input{flex:1 1 9rem;min-width:0;min-height:44px;width:100%;border:1px solid #91a89a;border-radius:.5rem;padding:.4rem .6rem}
#custom-form{margin-block:.15rem .4rem}#custom-form label{display:block;font-size:.9rem;font-weight:650;margin-bottom:.2rem}#own-error:empty{display:none}#own-error{color:var(--rust)}
#balance[data-model=seesaw] .scale-only,#balance[data-model=scale] .seesaw-only{display:none}
.parenthesis{display:inline-block;white-space:nowrap;background:#e5f1e9;color:#234b3c;border-block-end:2px solid #587b69;border-radius:.17em;padding-inline:.04em}
#group-source{margin:.1rem 0 .4rem}#group-source bdi{font-weight:650;color:var(--ink)}
.distributed{display:block;width:fit-content;margin-top:.25rem;color:var(--ink);font:550 1.08rem/1.4 Georgia,serif}
.paired,.history-math{display:grid;grid-template-columns:minmax(0,1fr) 1.3em minmax(0,1fr);align-items:center;gap:.1em;text-align:center}
.paired>span,.history-math>span{min-width:0;overflow-wrap:anywhere}.scale-eq{font:550 clamp(1.15rem,2.7vw,1.55rem)/1.25 Georgia,serif;margin:0 auto .45rem}
#coach{padding:.38rem .65rem;border-inline-start:3px solid #71947a;background:#eaf1e9;color:#2e4b3b;font-size:1rem;line-height:1.34}.scale-card:not([data-balance=level]) #coach{background:#f9eee2;border-color:#ae713d;color:#60432e}
.equation{margin:.45rem 0 .4rem;padding:.35rem .12rem;background:#f2f6f0;border-radius:.6rem;font:550 clamp(1.52rem,3.6vw,2.2rem)/1.2 Georgia,serif;font-variant-numeric:lining-nums tabular-nums}
.operations label{display:grid;min-width:0;justify-items:center;gap:.15rem;font-size:.9rem;font-weight:650;line-height:1.25;color:var(--muted)}.operations input{width:min(100%,14rem);height:2.75rem;text-align:center;border:1.5px solid #96745f;border-radius:.5rem;background:#fffcf8;color:var(--ink);font-size:1.125rem}
.operations input[aria-invalid=true]{border:2px solid #ad432b}.input-tools{justify-content:space-between;gap:.45rem;margin-top:.65rem}.symbols{gap:.2rem}.symbols button{min-width:44px;min-height:44px;padding:.1rem;font-weight:650;font-size:1.04rem}
.primary{background:var(--green);color:white;font-weight:650;border-color:var(--green)}.primary:hover{background:#1f4537}.guide{font-size:.9rem;line-height:1.38;margin-top:.4rem}.text-button,.options summary{display:inline-flex;align-items:center;min-height:44px;border:0;padding:.2rem .05rem;background:transparent;text-decoration:underline;text-underline-offset:.18em}.text-button:hover{background:transparent}
#feedback:not(:empty){margin:.45rem 0;padding:.45rem .65rem;border-inline-start:3px solid #53906d;background:#f0f6ee}#feedback[data-kind=error]:not(:empty){border-color:#a54e30;background:#fff2e8}#feedback:empty{display:none}
.options{display:flex;align-items:start;justify-content:space-between;gap:.35rem .8rem;flex-wrap:wrap;padding-block:.375rem}.options details{min-width:0;flex:1 1 15rem}.options #new{margin-inline-start:auto}.options summary{color:var(--green);font-weight:650;list-style:none;gap:.5rem}.options summary::-webkit-details-marker{display:none}.options summary:after{content:'';width:.42rem;height:.42rem;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg)}.options details[open] summary:after{transform:rotate(225deg)}
.settings{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr));gap:.5rem}:is(.settings label,.kind-choice){display:grid;min-width:0;gap:.18rem;font-size:.9rem;font-weight:650}:is(.settings select,.kind-choice select){display:block;width:100%;font-size:1rem;font-weight:400;appearance:none;-webkit-appearance:none;padding-inline:.55rem 1.6rem;background-image:linear-gradient(45deg,transparent 50%,#405e4d 50%),linear-gradient(135deg,#405e4d 50%,transparent 50%);background-size:5px 5px;background-repeat:no-repeat;background-position:right .83rem center,right .53rem center}
[dir=rtl] :is(.settings select,.kind-choice select){background-position:left .53rem center,left .83rem center}.options .guide{margin-block:.45rem .35rem}.history ol{list-style:none;padding:0}.history h2{margin-bottom:.4rem}.history li+li{border-top:1px solid #dce5dc}.history li button{display:grid;grid-template-columns:auto minmax(0,1fr) minmax(0,1fr);width:100%;gap:.35rem;align-items:center;text-align:start;border:0;background:transparent}.history li button:hover,.history li button[aria-pressed=true]{background:#edf3e9}.history-math{font:1.06rem/1.3 Georgia,serif}.history-op{color:var(--muted);font-size:.94rem}.history-step{font-size:.875rem;color:var(--green);font-weight:650}
.frac{display:inline-flex;flex-direction:column;text-align:center;vertical-align:-.34em;font-size:.82em;line-height:1.02;margin-inline:.08em}.frac>span:first-child{border-bottom:1.5px solid currentColor;padding:0 .12em .06em}.frac>span+span{padding-top:.07em}
.balance-trainer .worksheet .vg-math-keys{width:100%;margin:.35rem 0}.balance-trainer .worksheet .vg-math-keys>button,.balance-trainer .worksheet .vg-math-keys .vg-key-panel:not([hidden]){position:static;inset:auto;max-width:100%;width:auto;max-height:none;box-shadow:none}.balance-trainer .worksheet .vg-key-bar button{min-width:0;overflow-wrap:anywhere}
html.vg-compact:has(.vg-key-panel:not([hidden])) body.balance-trainer{padding-bottom:0}
.heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: .4rem 1rem; }
.kind-choice { max-width: 100%; }
@media (max-width: 40rem) {
  .heading .kind-choice { display: flex; align-items: center; flex: 1 1 100%; flex-wrap: wrap; gap: .25rem .6rem; }
  .kind-choice select { width: auto; flex: 0 1 auto; }
}
[hidden]{display:none!important}
@media(max-width:32rem){.input-tools .primary{flex:1 1 auto}.settings{grid-template-columns:minmax(0,1fr)}.options details{flex:1 1 8rem}.options details[open]{flex-basis:100%}.history li button{grid-template-columns:auto minmax(0,1fr)}.history-op{grid-column:2}}
@media(max-width:22rem){.symbols{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));width:100%;gap:.1rem}.symbols button{min-width:0}.worksheet,.scale-card{padding:.5rem}.balance-trainer main{padding-inline:.45rem}}
@media screen and (min-width:42rem) {
  .balance-trainer main {max-width:66rem}
  .workbench {grid-template-columns:minmax(0,.92fr) minmax(0,1.08fr);align-items:start}
  .scale-card {position:sticky;top:calc(var(--vg-bar-height,0px) + .35rem)}
  .workbench>.options,.workbench>.history {grid-column:1/-1}
}
@media screen and (max-width:41.99rem) {
  .workbench:has(#step-form:focus-within) .scale-card {
    position:sticky;top:var(--vg-bar-height,0px);z-index:5;padding-block:.28rem;
  }
  .workbench:has(#step-form:focus-within) .scale-picture svg {height:clamp(3rem,13dvh,5.5rem)}
  .workbench:has(#step-form:focus-within) .scale-picture .has-groups {height:clamp(5.25rem,24dvh,8.5rem)}
  .workbench:has(#step-form:focus-within) .scale-eq {margin-bottom:.15rem}
  .workbench:has(#step-form:focus-within) #coach {font-size:.88rem;padding-block:.2rem}
  .operations input {scroll-margin-top:calc(var(--vg-bar-height,0px) + 11rem)}
}
@media(forced-colors:active){:is(.settings select,.kind-choice select){appearance:auto;background-image:none}}
@media print{body{background:white}body>header,.kind-choice,.options,.input-tools,form,#undo,#next,#return,#hint,.vg-site-links,.vg-tools,.vg-math-keys{display:none!important}main{max-width:none}.worksheet,.scale-card,.history{break-inside:avoid}}
@media print{.model-choice{display:none}#scale-title{position:static;width:auto;height:auto;overflow:visible;clip-path:none;white-space:normal}}
