/* Fix20–23: specific game and guided lesson improvements, no global app rules. */
/* Only the original sequence keypad is used; no duplicated numeric pads or OS keyboard. */
#fun.safeR27ActivityMode #activityArea:has(.v171SeqWrap){padding-bottom:calc(206px + env(safe-area-inset-bottom,0px))!important}
#fun.safeR27ActivityMode .v171SeqPad{position:fixed!important;z-index:4900!important;bottom:0!important;left:0!important;right:0!important;direction:ltr!important;background:#e8f3ec!important;border-top:1px solid #b6d6c6!important;box-shadow:0 -8px 20px #21463928!important;padding:6px 8px calc(8px + env(safe-area-inset-bottom,0px))!important;display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;grid-auto-rows:minmax(38px,1fr)!important;gap:5px!important;height:calc(192px + env(safe-area-inset-bottom,0px))!important;box-sizing:border-box!important}
#fun.safeR27ActivityMode .v171SeqPad button{min-width:0!important;min-height:36px!important;padding:1px!important;font-size:clamp(17px,5vw,24px)!important}
#fun.safeR27ActivityMode .v171SeqWrap{min-width:0!important}
#fun.safeR27ActivityMode .v171SeqAnswer input{caret-color:transparent!important;cursor:default}
@media(max-height:560px){#fun.safeR27ActivityMode .v171SeqPad{height:146px!important;grid-auto-rows:1fr!important;padding:3px 7px!important}#fun.safeR27ActivityMode #activityArea:has(.v171SeqWrap){padding-bottom:154px!important}}
/* Compact mental soroban: correct one-over-four beads, without the 760px minimum width. */
#fun.safeR27ActivityMode #activityArea:has(#mentalAb) .ab-mini{overflow:hidden!important;max-height:265px!important;padding:5px!important}
#fun.safeR27ActivityMode #activityArea:has(#mentalAb) .ab-mini .abframe{box-sizing:border-box!important;width:100%!important;min-width:0!important;padding:6px 9px 20px!important;border-width:6px!important;box-shadow:none!important}
#fun.safeR27ActivityMode #mentalAb{height:198px!important;min-width:0!important;width:100%!important;gap:3px!important}
#fun.safeR27ActivityMode #mentalAb .rod{flex:1 1 0!important;min-width:0!important;border-left-width:2px!important}
#fun.safeR27ActivityMode #mentalAb .bead{width:min(88%,40px)!important;height:17px!important}
#fun.safeR27ActivityMode #mentalAb:after{top:57px!important;height:11px!important;box-shadow:none!important}
#fun.safeR27ActivityMode #mentalAb:before{display:none!important}
#fun.safeR27ActivityMode #mentalAb .digit{bottom:-21px!important;font-size:12px!important}
#fun.safeR27ActivityMode #mentalAnswerBox{margin:5px 0!important;display:flex!important;gap:8px!important;align-items:center!important;justify-content:center!important}
#fun.safeR27ActivityMode #mentalAnswerBox.hidden{display:none!important}
#fun.safeR27ActivityMode #mentalAnswerBox .field{flex:1!important;max-width:240px!important;margin:0!important}
#fun.safeR27ActivityMode #mentalAnswerBox button{flex:0 0 auto!important}
@media(max-height:520px){#fun.safeR27ActivityMode #mentalAb{height:124px!important}#fun.safeR27ActivityMode #activityArea:has(#mentalAb) .ab-mini{max-height:155px!important}#fun.safeR27ActivityMode #mentalAb:after{top:35px!important;height:8px!important}#fun.safeR27ActivityMode #mentalAb .bead{height:11px!important;width:min(88%,32px)!important}#fun.safeR27ActivityMode #mentalAb .digit{bottom:-18px!important}}
/* Display both teacher-provided difference images side by side with a visible count. */
#fun.safeR27ActivityMode #activityArea:has(#diffStudentTarget) .diffImageGrid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:5px!important}
#fun.safeR27ActivityMode #activityArea:has(#diffStudentTarget) .diffImageWrap{min-width:0!important}
