/* v045 — Practice/workspace "Finish question" bar reachable + pinned on tablet.
 *
 * Bug: at <=980px .workspaceGrid collapses to one column with questionPaper +
 * workingPanel each min-height:calc(100vh - 120px), so the grid grows to ~2.2
 * viewports. It was never a scroll container while #workspace is overflow:hidden,
 * so the .workspaceSubmit ("Finish question") fell to y~1247 on an 820x1180 iPad
 * and was clipped/unreachable ("no submit button"). Phone (<=600px) already did
 * overflow:auto via v030; the 601-980 tablet band was the gap.
 *
 * Fix: bind the grid as the scroll container AND pin the pre-submit submit bar to
 * the viewport bottom (position:fixed) so it is ALWAYS visible/tappable. Scoped to
 * .workspaceSubmit.inkSubmit (the "Finish question" bar) so the post-submit
 * "Next question" bar (no .inkSubmit class, lives in .answerStage) is untouched.
 * Desktop (>=981) keeps its 2-col grid; phone (<=600) keeps v030's own rules.
 * Loaded last so the !important wins the cascade. */

@media (min-width: 601px) and (max-width: 980px) {
  body.workspace-mode #workspace .workspaceGrid {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 54px; /* clear the fixed submit bar */
  }

  body.workspace-mode #workspace .workspaceSubmit.inkSubmit {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    background: #fff;
    border-top: 1px solid var(--line);
    margin: 0;
  }

  /* Once the answer / self-mark view takes over, the grid stays in flow and the
     answerStage is a normal block below it, so hide the pinned bar to avoid overlap. */
  body.workspace-mode #workspace:has(#answerStage.show) .workspaceSubmit.inkSubmit,
  body.workspace-mode #workspace:has(#submittedWork.show) .workspaceSubmit.inkSubmit {
    display: none !important;
  }
}
