/* qxmd239: last-wins lock — Prev|Check|Next and practice tools stay on screen.
   Later secondary CSS (practice-read, solution, mobile) must not hide the bar. */

html body .eg-test-root,
html body .eg-test-root.eg-qxmd182,
html body .eg-test-root.eg-qxtool8,
html body .mtk-test-root.allen-practice {
  overflow: visible !important;
}

html body .eg-test-root.eg-qxmd182 .eg-body,
html body .eg-test-root .eg-body {
  overflow-x: auto !important;
  overflow-y: auto !important;
  min-height: 0 !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-x pan-y !important;
}
html body .eg-test-root.eg-qxmd182 .eg-main,
html body .eg-test-root .eg-main,
html body .eg-test-root.eg-qxmd182 .eg-q-card,
html body .eg-test-root .eg-q-card,
html body .mtk-test-root .mtk-main {
  overflow: visible !important;
  min-height: 0 !important;
}

html body .eg-test-root[data-eg-mode="practice"] > #egFoot,
html body .eg-test-root[data-eg-mode="practice"] > .eg-foot,
html body .eg-test-root.eg-qxmd182[data-eg-mode="practice"] > #egFoot,
html body .eg-test-root.eg-qxmd182[data-eg-mode="practice"] > .eg-foot,
html body .eg-test-root.eg-qxtool8[data-eg-mode="practice"] > #egFoot,
html body .eg-test-root[data-eg-mode="practice"] #egFoot,
html body .eg-test-root[data-eg-mode="practice"] .eg-foot,
html body .eg-test-root[data-eg-mode="practice"] .eg-foot.eg-foot-marks,
html body .eg-test-root[data-eg-mode="practice"] .eg-foot.eg-foot-practice,
html body .allen-practice #egFoot,
html body .allen-practice .eg-foot,
html body.allen-practice-active .mtk-test-root.allen-practice .eg-foot,
html body.allen-practice-active .mtk-test-root.allen-practice .mtk-controls,
html body #egFoot.eg-foot.eg-foot-marks.eg-foot-practice {
  display: grid !important;
  grid-template-columns: 1fr 1.2fr 1fr !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  min-height: 56px !important;
  height: auto !important;
  max-height: none !important;
  width: 100% !important;
  padding: 8px 10px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 2147483646 !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  border-top: 1px solid #e5e7eb !important;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12) !important;
  transform: none !important;
  overflow: visible !important;
}

html body .eg-test-root[data-test-theme="dark"] > #egFoot,
html body .eg-test-root[data-test-theme="dark"] > .eg-foot,
html body .eg-test-root[data-test-theme="dark"] #egFoot,
html body .eg-test-root[data-test-theme="dark"] .eg-foot,
html body .eg-test-root.eg-qxmd182[data-test-theme="dark"] > .eg-foot,
html body .allen-practice[data-test-theme="dark"] #egFoot,
html body.allen-practice-active .mtk-test-root.allen-practice[data-test-theme="dark"] .eg-foot,
html[data-theme="dark"] body .eg-test-root[data-test-theme="dark"] #egFoot {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border-top: 1px solid #334155 !important;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4) !important;
}

html body .eg-test-root #egFoot #qxPrevBtn,
html body .eg-test-root #egFoot #qxNextBtn,
html body .eg-test-root #egFoot #egCheckBtn,
html body .eg-test-root.eg-qxmd182 .eg-foot #qxPrevBtn,
html body .eg-test-root.eg-qxmd182 .eg-foot #qxNextBtn,
html body .eg-test-root.eg-qxmd182 .eg-foot #egCheckBtn,
html body .eg-test-root.qx-sol-showing .eg-foot #qxPrevBtn,
html body .eg-test-root.qx-sol-showing .eg-foot #qxNextBtn,
html body #egFoot #qxPrevBtn,
html body #egFoot #qxNextBtn,
html body #egFoot #egCheckBtn,
html body #egFoot #qxPracPrev,
html body #egFoot #qxPracNext,
html body #egFoot #qxPracSubmit {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  min-height: 52px !important;
  height: 52px !important;
  max-height: 52px !important;
  width: 100% !important;
  align-items: center !important;
  justify-content: center !important;
}

html body .eg-test-root:not([data-test-theme="dark"]) #egFoot #qxPrevBtn,
html body .eg-test-root:not([data-test-theme="dark"]) #egFoot #qxNextBtn,
html body .eg-test-root.eg-qxmd182:not([data-test-theme="dark"]) .eg-foot #qxPrevBtn,
html body .eg-test-root.eg-qxmd182:not([data-test-theme="dark"]) .eg-foot #qxNextBtn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
}

html body .eg-test-root[data-test-theme="dark"] #egFoot #qxPrevBtn,
html body .eg-test-root[data-test-theme="dark"] #egFoot #qxNextBtn,
html body .eg-test-root.eg-qxmd182[data-test-theme="dark"] .eg-foot #qxPrevBtn,
html body .eg-test-root.eg-qxmd182[data-test-theme="dark"] .eg-foot #qxNextBtn {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border: 1.5px solid #64748b !important;
}

html body .eg-test-root .eg-top,
html body .eg-test-root.eg-qxmd182 > .eg-top,
html body .eg-test-root.eg-qxtool8 .eg-top {
  max-height: none !important;
  overflow: visible !important;
  flex-wrap: wrap !important;
  flex-shrink: 0 !important;
}

html body .eg-test-root .eg-top-tools,
html body .eg-test-root[data-eg-mode="practice"] .eg-top-tools,
html body .eg-test-root.eg-qxmd167 .eg-top-tools {
  display: flex !important;
  flex-wrap: wrap !important;
  overflow: visible !important;
  max-width: none !important;
}

html body .eg-test-root .eg-top-tools .eg-tool-btn,
html body .eg-test-root[data-eg-mode="practice"] .eg-top-tools .eg-tool-btn,
html body .eg-test-root.eg-qxmd167[data-eg-mode="practice"] .eg-top-tools .eg-tool-sec,
html body .eg-test-root.eg-qxmd167[data-eg-mode="practice"] .eg-top-tools .eg-tool-sec:not(.eg-tool-reach),
html body .eg-test-root.eg-qxmd217 .eg-top-tools .eg-tool-btn:not(#egFmtBtn) {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* qxmd295: test 2×2 footer stays pinned; practice 3-col stays above. */
html body .eg-test-root[data-eg-mode="test"] > #egFoot,
html body .eg-test-root[data-eg-mode="test"] #egFoot,
html body .eg-test-root[data-eg-mode="test"] .eg-foot,
html body #egFoot.eg-foot-marks-test {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 48px 48px !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  transform: none !important;
  height: auto !important;
  min-height: calc(120px + max(36px, env(safe-area-inset-bottom, 0px))) !important;
  max-height: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 10px 12px calc(10px + max(36px, env(safe-area-inset-bottom, 0px))) !important;
  z-index: 2147483000 !important;
  grid-auto-flow: row !important;
}
html body .eg-test-root[data-eg-mode="test"] #qxClearBtn { grid-area: 1 / 1 !important; }
html body .eg-test-root[data-eg-mode="test"] #qxReviewNextBtn { grid-area: 1 / 2 !important; }
html body .eg-test-root[data-eg-mode="test"] #qxPrevBtn { grid-area: 2 / 1 !important; }
html body .eg-test-root[data-eg-mode="test"] #qxSaveBtn { grid-area: 2 / 2 !important; transform: none !important; }
