
/* MathCrave Worksheets shared stability layer v1.1.1
   Loaded after the individual worksheet CSS so the WordPress shell has one predictable scroll surface. */
.mathcrave-worksheet-root{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  min-height:100dvh!important;
  height:auto!important;
  overflow:visible!important;
  display:flex!important;
  align-items:stretch!important;
  background:#0f172a!important;
  color:#cbd5e1;
}
.mathcrave-worksheet-root,.mathcrave-worksheet-root *{box-sizing:border-box;}
.mathcrave-worksheet-root > aside.sidebar,
.mathcrave-worksheet-root > #sidebar{
  flex:0 0 18rem!important;
  width:18rem!important;
  min-width:18rem!important;
  height:100dvh!important;
  max-height:100dvh!important;
  position:sticky!important;
  top:0!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  align-self:flex-start!important;
  background:#1e293b!important;
  border-right:1px solid #334155!important;
}
.mathcrave-worksheet-root > main,
.mathcrave-worksheet-root > .main-content,
.mathcrave-worksheet-root > #main-content{
  flex:1 1 auto!important;
  width:auto!important;
  min-width:0!important;
  max-width:100%!important;
  height:auto!important;
  min-height:100dvh!important;
  overflow:visible!important;
  background:#0f172a!important;
  margin:0!important;
  margin-left:0!important;
  margin-right:0!important;
  padding-left:0!important;
  padding-right:0!important;
  position:relative!important;
  left:auto!important;
  right:auto!important;
  transform:none!important;
}
/* Keep worksheet content close to the sidebar. Legacy worksheet/theme rules sometimes
   add a second sidebar-sized left offset to <main> or its content wrapper. */
.mathcrave-worksheet-root > main > header,
.mathcrave-worksheet-root > .main-content > header,
.mathcrave-worksheet-root > #main-content > header{
  width:100%!important;
  max-width:none!important;
  margin-left:0!important;
  margin-right:0!important;
}
.mathcrave-worksheet-root .content-section{
  width:100%!important;
  max-width:none!important;
  margin-left:0!important;
  margin-right:0!important;
  padding-left:clamp(1rem,2vw,1.5rem)!important;
  padding-right:clamp(1rem,2vw,1.5rem)!important;
}
.mathcrave-worksheet-root .generator-controls,
.mathcrave-worksheet-root .question-item,
.mathcrave-worksheet-root .actions,
.mathcrave-worksheet-root .question-text,
.mathcrave-worksheet-root .content-section,
.mathcrave-worksheet-root .solver-card,
.mathcrave-worksheet-root .info-card{
  min-width:0!important;
  max-width:100%!important;
}
.mathcrave-worksheet-root .katex-display{
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  -webkit-overflow-scrolling:touch;
}
/* Preserve the original animated answer/steps panel, consistently at the bottom-right. */
.mathcrave-worksheet-root #snackbar{
  position:fixed!important;
  right:max(18px,env(safe-area-inset-right))!important;
  bottom:max(18px,env(safe-area-inset-bottom))!important;
  left:auto!important;
  width:min(450px,calc(100vw - 36px))!important;
  max-width:min(450px,calc(100vw - 36px))!important;
  max-height:min(72vh,620px)!important;
  overflow:auto!important;
  z-index:10050!important;
  background:#374151!important;
  color:#e5e7eb!important;
  border:1px solid #475569!important;
  border-radius:.65rem!important;
  box-shadow:0 18px 50px rgba(0,0,0,.36)!important;
  transform:translateY(18px)!important;
  opacity:0!important;
  visibility:hidden!important;
  pointer-events:none!important;
  transition:opacity .22s ease,transform .22s ease,visibility .22s ease!important;
}
.mathcrave-worksheet-root #snackbar.show{
  opacity:1!important;
  visibility:visible!important;
  pointer-events:auto!important;
  transform:translateY(0)!important;
}
.mathcrave-worksheet-root #snackbarTitle{color:#a78bfa!important;}
.mathcrave-worksheet-root #snackbarMessage{overflow-wrap:anywhere;}
.mathcrave-worksheet-root #snackbarMessage .katex-display{overflow-x:auto!important;}
.mathcrave-worksheet-root #closeSnackbar{min-width:36px;min-height:36px;display:inline-flex;align-items:center;justify-content:center;}
.mcw-mobile-toolbar{display:none;}
@media (max-width:767px){
  .mathcrave-worksheet-root{display:block!important;min-height:100dvh!important;}
  .mathcrave-worksheet-root > aside.sidebar,
  .mathcrave-worksheet-root > #sidebar{
    position:fixed!important;
    inset:0 auto 0 0!important;
    width:min(86vw,18rem)!important;
    min-width:0!important;
    height:100dvh!important;
    max-height:100dvh!important;
    z-index:10020!important;
    transform:translateX(-100%)!important;
    transition:transform .22s ease!important;
  }
  .mathcrave-worksheet-root > aside.sidebar.active,
  .mathcrave-worksheet-root > #sidebar.active,
  .mathcrave-worksheet-root > aside.sidebar.sidebar-visible,
  .mathcrave-worksheet-root > #sidebar.sidebar-visible{transform:translateX(0)!important;}
  .mathcrave-worksheet-root > main,
  .mathcrave-worksheet-root > .main-content,
  .mathcrave-worksheet-root > #main-content{
    width:100%!important;
    min-height:100dvh!important;
    margin-left:0!important;
    overflow-x:hidden!important;
  }
  .mathcrave-worksheet-root .generator-controls{grid-template-columns:1fr!important;}
  .mathcrave-worksheet-root .actions{display:grid!important;grid-template-columns:1fr!important;gap:.6rem!important;}
  .mathcrave-worksheet-root .actions button{width:100%!important;min-height:46px!important;}
  .mathcrave-worksheet-root #snackbar{
    right:12px!important;
    bottom:max(12px,env(safe-area-inset-bottom))!important;
    width:calc(100vw - 24px)!important;
    max-width:calc(100vw - 24px)!important;
    max-height:68vh!important;
  }
  .mcw-mobile-toolbar{
    display:flex;
    position:sticky;
    top:0;
    z-index:40;
    align-items:center;
    justify-content:space-between;
    padding:.75rem 1rem;
    background:rgba(15,23,42,.96);
    border-bottom:1px solid #334155;
  }
  .mcw-mobile-toolbar button{min-width:44px;min-height:44px;border:0;border-radius:.5rem;background:#1e293b;color:#e2e8f0;font-size:1.25rem;}
}
