/* WorksheetOnline v3.7.28 — Responsive UX without changing worksheet print sizes. */
@media screen and (max-width:800px){
  html{max-width:100%;}
  body{max-width:100%;min-width:0;}
  :where(main,section,article,.container,.wrap,.workspace,.work-layout,.wsf-container){min-width:0;}
  :where(a,button,select,input[type="button"],input[type="submit"]){touch-action:manipulation;}
  :where(input,select,textarea){max-width:100%;}
  /* Long same-origin worksheet iframes are resized to content; let vertical
     swipes scroll the parent page instead of trapping touch inside the frame. */
  #ws-division-tool-frame,#wsf-child-iframe{max-width:100%!important;min-width:0!important;touch-action:pan-y pinch-zoom!important;overscroll-behavior:contain;}

  /* Standalone pages that did not include a mobile navigation trigger. */
  .ws-mobile-nav-host{position:relative!important;}
  .ws-mobile-nav-button{border:1px solid #c6e2d0!important;background:#fff!important;color:#126d49!important;
    width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;padding:0!important;
    display:inline-flex!important;align-items:center!important;justify-content:center!important;flex:0 0 auto!important;
    border-radius:11px!important;font-size:22px!important;line-height:1!important;cursor:pointer!important;z-index:10012!important;}
  .ws-mobile-nav-button:focus-visible{outline:3px solid #8acaa5!important;outline-offset:3px!important;}
  .ws-mobile-enhanced-nav{display:none!important;position:absolute!important;top:calc(100% + 7px)!important;
    right:0!important;left:auto!important;bottom:auto!important;float:none!important;width:min(340px,calc(100vw - 24px))!important;
    max-width:calc(100vw - 24px)!important;max-height:min(75vh,500px)!important;
    padding:10px!important;margin:0!important;z-index:10011!important;overflow-y:auto!important;
    background:#fff!important;border:1px solid #cbded1!important;border-radius:14px!important;
    box-shadow:0 18px 45px rgba(12,46,26,.22)!important;
    flex-flow:column nowrap!important;gap:2px!important;align-items:stretch!important;justify-content:flex-start!important;}
  .ws-mobile-enhanced-nav.ws-mobile-nav-open{display:flex!important;}
  .ws-mobile-enhanced-nav a{display:flex!important;align-items:center!important;min-height:44px!important;
    padding:10px 13px!important;border-radius:9px!important;color:#204b34!important;text-align:left!important;
    white-space:normal!important;font-weight:700!important;font-size:14px!important;text-decoration:none!important;}
  .ws-mobile-enhanced-nav a:hover,.ws-mobile-enhanced-nav a:focus-visible{background:#eaf6ee!important;}
  /* Fraction main page: pager controls must be tappable, but not alter the A4 preview. */
  body.ws-fractions-collection-page :is(.pager button,.page-controls button,.preview-tools button){
    min-width:40px;min-height:40px;}
  /* The multiplication generator exposes six skill tabs: make them scrollable/tappable. */
  :is(body.ws-multiplication-collection-page,body.ws-mul-child-page) .mw-tabs{
    max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;}
  :is(body.ws-multiplication-collection-page,body.ws-mul-child-page) .mw-tab{
    min-height:40px;min-width:70px;padding:9px 12px;}
}
@media screen and (min-width:801px){
  .ws-mobile-nav-button{display:none!important;}
  .ws-mobile-enhanced-nav{position:static!important;}
}

/* The homepage has an extra 651–950px breakpoint whose specificity otherwise
   hides the opened native dropdown. Keep the original desktop breakpoint. */
@media screen and (max-width:950px){
  body.ws-homepage-page .navlinks.mobile-open{display:flex!important;position:absolute!important;
    top:calc(100% - 2px)!important;left:10px!important;right:10px!important;
    padding:13px!important;background:#fff!important;flex-direction:column!important;gap:5px!important;
    border:1px solid #d5e9da!important;border-radius:14px!important;box-shadow:0 12px 30px #17473024!important;z-index:60!important;}
  body.ws-homepage-page .mobile-menu{min-width:44px!important;min-height:44px!important;border-radius:10px!important;}
}
@media screen and (max-width:700px){
  body.ws-mul-child-page button.mobile-menu,body.ws-div-child-page button.mobile-menu{
    min-width:44px!important;min-height:44px!important;padding:8px 12px!important;line-height:1!important;}
}

/* Addition/Subtraction originally stay in two columns until 740px, leaving a
   clipped 650px worksheet in a ~380px panel on tablets. Use one column until
   there is genuinely enough room for the A4 sheet alongside the settings. */
@media screen and (min-width:741px) and (max-width:1079px){
  body.ws-addition-collection-page .generator-app,
  body.ws-subtraction-collection-page .generator-app{
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.ws-addition-collection-page .gen-preview,
  body.ws-subtraction-collection-page .gen-preview{min-width:0;max-width:100%;}
}

/* Division collection has the same tablet bottleneck: a 285px settings column
   steals half the A4 preview width before the layout switches at 730px. */
@media screen and (min-width:731px) and (max-width:1079px){
  body.ws-division-collection-page .m-app{grid-template-columns:minmax(0,1fr)!important;}
  body.ws-division-collection-page .m-panel,
  body.ws-division-collection-page .m-preview{min-width:0;max-width:100%;}
}

/* Standard WordPress posts/categories use the legacy shared header. Its old
   CSS reorders the search and logo on phones; explicitly put the brand first,
   the new menu button on the right and the search bar on the following row. */
@media screen and (max-width:800px){
  body:not(.ws-homepage-page):not(.ws-fractions-collection-page) header.header .topbar{
    display:flex!important;flex-wrap:wrap!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;}
  header.header .topbar>.logo{order:1!important;flex:0 1 auto!important;min-width:0;}
  header.header .topbar>.ws-mobile-nav-button{order:2!important;margin-left:auto!important;}
  header.header .topbar>.search-box{order:3!important;flex:1 0 100%!important;max-width:100%!important;width:100%!important;}
  header.header .topbar>.ws-mobile-enhanced-nav{order:4!important;}
}
