/* The board scales to space left by the controls, not to a guessed viewport offset. */
body{min-height:0}
.shell{height:100dvh;min-height:0;width:min(100%,48rem);display:flex;flex-direction:column;gap:.3rem;padding:.4rem clamp(.45rem,2vw,.95rem);position:relative}
.shell>*{flex:none;min-width:0}
.shell header{gap:.5rem;min-height:33px}
.shell .title,.touch-keys .shell .title{margin:0;font-size:clamp(1.12rem,3.6vw,1.75rem);line-height:1.06;letter-spacing:.06em}
.shell .sound-toggle{min-height:32px;padding:.25rem .55rem}
.shell .toolbar,.touch-keys .shell .toolbar{gap:.32rem .5rem;margin:0}
.shell .toolbar select{min-height:31px;padding:.25rem .4rem}
.shell .stage-label{font-size:.72rem;padding:.23rem .4rem}
.shell .royal,.shell .secondary{min-height:34px;padding:.3rem .65rem;box-shadow:0 2px 0 #825521}
.shell .secondary{box-shadow:none}
.shell .status{align-items:center;justify-content:space-between;width:min(100%,34rem);max-width:none;gap:.4rem;font-size:.74rem;margin:0 auto}
.shell .rivals-wallet{gap:.25rem;padding:.18rem .38rem;white-space:nowrap}
.shell .wallet-medallion{width:19px;height:19px}
.shell .progress,.touch-keys .shell .progress{width:min(100%,34rem);max-width:none;margin:0 auto}
.shell .board-slot{flex:1 1 0;min-height:0;min-width:0;display:grid;place-items:center;container-type:size}
.shell .board-frame,.touch-keys .shell .board-frame{min-width:0;width:min(100%,100cqh,25rem);aspect-ratio:1;padding:clamp(3px,1cqh,7px);margin:0}
.shell .board{gap:clamp(1px,.55cqh,3px)}
.shell .cell{font-size:clamp(.52rem,3.4cqh,.83rem);border-radius:3px}
.shell .question,.touch-keys .shell .question{margin:0 auto;width:min(100%,34rem);max-width:none}
.shell .equation,.touch-keys .shell .equation{margin:0 0 .24rem;font-size:clamp(1.28rem,5vw,1.9rem);line-height:1.1}
.shell .answer-row input,.touch-keys .shell .answer-row input{min-height:34px;padding:.15rem .4rem;font-size:1.18rem}
.shell #instantHint,.touch-keys .shell #instantHint{margin:.18rem 0 0}
.shell .keypad,.touch-keys .shell .keypad{max-width:27rem;margin:.35rem auto .2rem;padding:0;gap:.33rem}
.shell .keypad button,.touch-keys .shell .keypad button{min-height:44px;border-radius:10px;padding:.2rem;font-size:1.34rem}
.shell .feedback,.touch-keys .shell .feedback{margin:.17rem 0 0;min-height:1.15rem;font-size:.82rem}
.shell .summary{margin:0 auto;width:min(100%,35rem);max-width:none}
.shell .summary h2{font-size:1rem;line-height:1.1}
.shell .summary p{font-size:.82rem;line-height:1.32;margin:.25rem 0}
.shell .score{gap:.65rem;margin:.3rem 0}.shell .score div{gap:0}.shell .score strong{font-size:1.08rem}
.shell .actions{margin:.25rem 0 0;gap:.35rem}
.shell .micro-footer{display:flex;flex-wrap:wrap;justify-content:center;gap:.15rem .6rem;margin:0;color:#c1d2ed}
.shell .micro-footer p{margin:0;font-size:.72rem;line-height:1.25;min-height:0}
.shell .board-key{position:relative;align-self:center;font-size:.75rem;line-height:1.2}
.shell .board-key summary{cursor:pointer;text-decoration:underline;padding:.12rem .3rem;color:#dbe9ff}
.shell .key-panel{position:absolute;z-index:8;left:50%;bottom:calc(100% + .3rem);transform:translateX(-50%);width:min(85vw,22rem);padding:.5rem;background:#16243e;border:1px solid #839fd5;border-radius:.6rem;box-shadow:0 10px 20px #0009}
.shell .key-panel .legend,.shell .key-panel .note{margin:.2rem 0}
@media(max-width:460px){
 .shell .toolbar label{gap:.22rem}
 .shell .status{font-size:.65rem;letter-spacing:0}
 .shell .rivals-wallet{gap:.2rem}
 .shell .wallet-medallion{width:17px;height:17px}
}
@media(orientation:landscape) and (max-height:490px){
 .shell{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.12fr);grid-template-rows:auto auto auto auto minmax(0,1fr) auto;gap:.22rem .5rem}
 .shell header,.shell .toolbar,.shell .status,.shell .progress,.shell .micro-footer{grid-column:1/-1}
 .shell .board-slot{grid-area:5/1;align-self:stretch}
 .shell .question,.shell .summary{grid-area:5/2;align-self:center}
 .shell .board-key{grid-area:6/1;justify-self:center}
 .shell .micro-footer{grid-area:6/2}
 .shell #instantHint{display:none}
 .shell .keypad button,.touch-keys .shell .keypad button{min-height:32px}
}
