.premium-game{--game-header:linear-gradient(100deg,#4e3026,#2e3025);--game-surround:#e9e2d6}
.abacus-board{display:grid;grid-template-rows:minmax(0,1fr) auto;flex:1;min-height:0;background:#f6efdf;color:#33251b}
.dark .abacus-board{background:#282822;color:#fff3d8}
.abacus-scene{min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:clamp(3px,.9dvh,9px);padding:clamp(5px,1.2dvh,14px) clamp(4px,1vw,16px);background:radial-gradient(ellipse at 50% 40%,#fff9ea,#eadac2)}
.dark .abacus-scene{background:radial-gradient(ellipse at 50% 40%,#484237,#302820)}
.abacus-scene h2,.abacus-instruction{margin:0;text-align:center;line-height:1.1;font-weight:900}
.abacus-scene h2{font-size:clamp(.91rem,2.45dvh,1.65rem)}
.abacus-instruction{min-height:1.2em;font-size:clamp(.66rem,1.75dvh,1.03rem);color:#654328}
.dark .abacus-instruction{color:#e6cdb6}
.abacus-rack,.abacus-example-rack{width:100%;min-height:0;min-width:0;display:grid;justify-items:center;container-type:size}
.abacus-mahogany{width:min(100%,820px);height:100%;min-height:0;box-sizing:border-box;display:grid;grid-template-columns:repeat(var(--rods),minmax(0,1fr));gap:clamp(2px,1.1cqw,8px);padding:clamp(4px,1.6cqw,13px);border:1px solid #66442c;border-radius:clamp(.46rem,2.4cqw,1.15rem);background:repeating-linear-gradient(174deg,#ffffff09 0 1px,transparent 1px 7px),linear-gradient(152deg,#9d6848,#65432d 76%,#4d3024);box-shadow:inset 0 2px 0 #f3caa282,inset 0 -4px 0 #2d170e4f,0 4px 8px #4c291826}
.abacus-column{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-height:0;min-width:0;gap:clamp(2px,.8cqh,7px);border-radius:.46rem;padding:2px;background:#f7e1bf;box-shadow:inset 0 2px 4px #4c291a40;--stain:#174f90}
.abacus-column[data-stain="ochre"]{--stain:#794800}.abacus-column[data-stain="green"]{--stain:#256741}.abacus-column[data-stain="teal"]{--stain:#04666d}.abacus-column[data-stain="plum"]{--stain:#663871}.abacus-column[data-stain="ruby"]{--stain:#9f313a}
.abacus-column[data-current="true"]{background:#fff4d7;outline:2px solid #ffda83;outline-offset:-1px}
.abacus-label{display:grid;place-items:center;text-align:center;min-height:2em;margin:0 1px;font-size:clamp(.56rem,3.4cqw,.95rem);line-height:1.02;color:var(--stain);font-weight:900;text-wrap:balance}
.abacus-rail{position:relative;display:flex;flex-direction:column-reverse;align-items:center;justify-content:flex-start;min-height:0;min-width:0;container-type:size;border-top:1px solid #c9a47d;border-bottom:2px solid #a57b53;padding:.12rem 0;background:linear-gradient(90deg,#b8865e25,#fff9e55c 48%,#b8865e22);overflow:hidden}
.abacus-rail:before{content:"";position:absolute;inset:0 auto 0 50%;transform:translateX(-50%);width:clamp(2px,8cqw,7px);background:linear-gradient(90deg,#5a3921,#dfb680 46%,#805531 85%);border-radius:8px}
.abacus-bead{position:relative;display:block;flex:none;width:min(93cqw,23cqh,95px);height:min(calc(100cqh / 9),39cqw,39px);object-fit:fill;min-height:1px;pointer-events:none}
.abacus-digit{display:grid;place-items:center;min-height:clamp(19px,11cqh,43px);border:1px solid #ad8057;border-radius:.34rem;background:#fff9e8;color:#30231b;font-size:clamp(.88rem,5.4cqw,1.6rem);line-height:1;font-weight:900}
.abacus-column[data-current="true"] .abacus-digit{border:2px solid var(--stain);box-shadow:0 0 0 1px #fff7df}
.abacus-keypad{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(3px,.55dvh,7px);padding:clamp(4px,.75dvh,9px);background:#e9d7ba;border-top:1px solid #ae8a63}
.dark .abacus-keypad{background:#393026}
.abacus-keypad button{min-height:clamp(27px,5.65dvh,63px);display:grid;place-items:center;border:1px solid #a78766;border-radius:.54rem;background:#fff9e9;box-shadow:0 2px 0 #a082613d;color:#372b22;font-size:clamp(.95rem,3dvh,1.85rem);line-height:1;font-weight:900}
.abacus-keypad button:hover{background:#fff3d2}.abacus-keypad button:active{transform:translateY(1px)}
.abacus-keypad .abacus-check{background:#2f694f;color:#fff;border-color:#20523b}
.abacus-keypad .abacus-clear{background:#edd7bc;color:#693b25}
.abacus-example-link,.abacus-example-actions button{background:#335943;color:#fff7e7;border-radius:.68rem;padding:.56em 1.1em;font-weight:900;min-height:2.5rem}
.abacus-example-link{margin-top:clamp(.65rem,2dvh,1.4rem)}
.abacus-example{display:grid;justify-items:center;align-content:center;grid-template-rows:auto minmax(0,auto) auto auto;gap:clamp(.35rem,1.3dvh,1rem);width:100%;min-height:100dvh;padding:.7rem;background:radial-gradient(ellipse at 50% 38%,#fff9ea,#e0ccaf);color:#37271c;text-align:center}
.dark .abacus-example{background:#302820;color:#fff4dd}
.abacus-example h2{font-size:clamp(1.2rem,4.2dvh,2.5rem);font-weight:900;margin:0}
.abacus-example-rack{height:min(44dvh,315px);width:min(95%,440px)}
.abacus-example p{font-size:clamp(.87rem,2.65dvh,1.25rem);font-weight:850;line-height:1.25;margin:.1rem 0;min-height:2.5em}
.abacus-example-actions{display:flex;gap:.45rem;flex-wrap:wrap;justify-content:center}
.abacus-example-actions button:last-child{background:#f5e6ca;color:#4d3425;border:1px solid #9a765b}
.settle-bead{animation:abacus-settle 560ms cubic-bezier(.22,.62,.26,1) backwards;animation-delay:var(--delay)}
@keyframes abacus-settle{from{transform:translateY(-60%);opacity:.72}to{transform:translateY(0);opacity:1}}
@media(orientation:landscape) and (max-height:580px){
  .premium-panels:is([data-count="1"],[data-count="2"]) .abacus-board{grid-template: minmax(0,1fr)/minmax(0,1fr) minmax(105px,.6fr)}
  .premium-panels:is([data-count="1"],[data-count="2"]) .abacus-keypad{align-content:center}
}
@media(prefers-reduced-motion:reduce){.settle-bead{animation:none}.abacus-keypad button:active{transform:none}}
