/* Fix77: mobile display corrections grounded in real Fix76 screenshots. */
@media(max-width:720px) and (orientation:portrait){
 /* The full-screen adventure has its own pause/menu, no outer duplicates. */
 body:has(#game.r42AdventurePage:not(.hidden)) #safeR10Bottom,
 body:has(#game.r42AdventurePage:not(.hidden)) #game>.saSettingsToggle,
 body:has(#game.r42AdventurePage:not(.hidden)) #game>.head,
 body:has(#game.r42AdventurePage:not(.hidden)) #app>header.top{display:none!important}
 body.r42AdventureMode #game.r42AdventurePage{top:0!important;inset:0!important;height:100dvh!important;max-height:100dvh!important;padding:0!important;overflow:hidden!important}
 body.r42AdventureMode #game.r42AdventurePage>.gamewrap{flex:1 1 100%!important;height:100%!important;min-height:0!important;max-height:100%!important;margin:0!important;padding:0!important;overflow:hidden!important}
 body.r42AdventureMode #game.r42AdventurePage.v19Embedded #v19EmbeddedGameHost,
 body.r42AdventureMode #game.r42AdventurePage.v19Embedded #v19EmbeddedGameFrame{height:100%!important;max-height:100%!important;min-height:0!important}
 /* Teacher is a separate full-screen lesson, with a short header and no footer bar. */
 body:has(#v183Teacher.open) #safeR10Bottom{display:none!important}
 #v183Teacher.open.sa77CounterView{overflow:hidden!important;grid-template-rows:auto minmax(0,1fr)!important}
 #v183Teacher.sa77CounterView .v183Top{min-height:0!important;max-height:105px!important;gap:4px!important;padding:4px 6px!important}
 #v183Teacher.sa77CounterView .v183Info small{display:none!important}
 #v183Teacher.sa77CounterView .v183Stage{overflow:hidden!important;min-height:0!important;grid-template-rows:auto minmax(0,1fr)!important;padding:4px!important}
 #v183Teacher.sa77CounterView .v183LessonStrip{min-height:25px!important;max-height:32px!important;padding:4px!important;margin:0 0 4px!important}
 #v183Teacher.sa77CounterView #v183Nav.sa77CompactNav{flex:1 0 100%!important;display:flex!important;flex-wrap:nowrap!important;grid-column:1/-1!important;gap:5px!important;height:39px!important;max-height:39px!important;overflow:visible!important;align-items:center!important;padding:0!important}
 #v183Teacher.sa77CounterView #v183Nav.sa77CompactNav>button{flex:1 1 0!important;min-width:0!important;min-height:35px!important;max-height:35px!important;padding:3px!important;font-size:clamp(11px,2.9vw,13px)!important}
 #v183Teacher.sa77CounterView #v183Nav #v183Current{flex:0 0 48px!important;min-height:35px!important;max-height:35px!important;font-size:16px!important;line-height:28px!important;padding:3px!important}
 #v183Teacher.sa77CounterView #v183LabMount{min-height:0!important;max-height:100%!important;overflow:hidden!important;align-items:flex-start!important;padding:0!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus{margin:0!important;padding:0!important;max-height:none!important;overflow:visible!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .abstage{height:auto!important;max-height:none!important;min-height:0!important;overflow:visible!important;margin:0!important;padding:4px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .abframe{height:auto!important;max-height:none!important;min-height:0!important;overflow:visible!important;margin:0!important;border-width:5px!important;padding:7px 3px 43px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .abinner{height:270px!important;min-height:270px!important;max-height:270px!important;overflow:visible!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .bead{height:24px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .heaven:not(.active){top:7px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .heaven.active{top:65px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .abinner:after{top:101px!important;height:15px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="1"]{top:143px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="2"]{top:169px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="3"]{top:195px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="4"]{top:221px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="1"].nearBar{top:119px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="2"].nearBar{top:145px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="3"].nearBar{top:171px!important}
 #v183Teacher.sa77CounterView #v183LabMount #abacus .lowerBead[data-rank="4"].nearBar{top:197px!important}
 #v183Teacher.sa77CounterView #v183ToolPanel{display:none!important}
 #v183Teacher.sa77CounterView.sa76SettingsOpen #v183ToolPanel{
  display:block!important;position:fixed!important;inset:66px 9px auto!important;
  max-height:calc(100dvh - 84px)!important;height:auto!important;width:auto!important;
  z-index:9999!important;overflow-y:auto!important;padding:13px!important;border-radius:18px!important;
  background:#fffaf3!important;box-shadow:0 0 0 200vmax #0b2519b8,0 10px 30px #0003!important
 }
 #v183Teacher.sa77CounterView .sa77Fields{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
 #v183Teacher.sa77CounterView .sa77Field{display:flex!important;flex-direction:column!important;gap:5px!important;min-width:0!important;font-weight:800!important;color:#164c38!important}
 #v183Teacher.sa77CounterView .sa77Field:first-child{grid-column:1/-1!important}
 #v183Teacher.sa77CounterView .sa77Field input,#v183Teacher.sa77CounterView .sa77Field select{width:100%!important;min-width:0!important;min-height:45px!important;font-size:17px!important}
 #v183Teacher.sa77CounterView .sa77Actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:9px!important;margin-top:14px!important}
 #v183Teacher.sa77CounterView .sa77Actions button{min-height:45px!important}
}

/* Show the real installed app icon rather than an empty image placeholder. */
#app>header.top .brand .logo{background-image:url('./icons/icon-192.png')!important;background-size:cover!important;background-position:center!important}
#app>header.top .brand .logo img{opacity:0!important}
@media(max-width:720px) and (orientation:portrait){
 body:has(#guidedLearning:not(.hidden)) #safeR10Bottom{display:none!important}
 /* The lesson selector should not display a second large promotional hero. */
 #guidedLearning.saGuidedAlwaysOpen>.v17GuidedHero{display:none!important}
 #guidedLearning #v183Hero>div:first-child{display:none!important}
 #guidedLearning #v183Hero{padding:6px!important;margin:3px 0 8px!important;min-height:0!important}
 #guidedLearning #v183Hero .v183HeroActions{gap:6px!important}
 #guidedLearning #v183Hero .v183HeroActions button{min-height:40px!important}
}
/* Match the older R57/R65 selectors exactly, rather than losing to their !important rules. */
@media(max-width:720px) and (orientation:portrait){
 body.r57-app-mode.r42AdventureMode #app > #game.r42AdventurePage > .head{display:none!important;height:0!important;min-height:0!important;max-height:0!important;flex:0 0 0!important}
 body.r57-app-mode.r42AdventureMode #app > #game.r42AdventurePage > .saSettingsToggle{display:none!important}
 body.r57-app-mode.r42AdventureMode #app > #game.r42AdventurePage > .gamewrap{height:100%!important;max-height:100%!important;flex:1 1 100%!important;padding:0!important;margin:0!important;overflow:hidden!important}
}

@media(max-width:720px){#guidedLearning .v17GuidedHero{display:none!important}.r35LockedLabel button{margin-top:7px!important;min-height:40px!important;width:100%!important}}
