/* =====================================================================
   v042 — practice question pane: real zoom + pan; one Finish paper
   ---------------------------------------------------------------------
   Overrides only. Nothing in v027–v041 is edited.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Give the question pane its scroll box back
   ---------------------------------------------------------------------
   v033 set `overflow:visible` on this pane so that a short question would
   not stretch the grid. That also removed any possibility of panning: with
   no overflow there is nothing to scroll, so a zoomed question simply sat
   there and a finger drag moved nothing. A max-height keeps short questions
   short while giving the pane a real scroll box once the question (or the
   zoom) is bigger than the space available. */
body.ial-v030.workspace-mode .questionPaper{
  overflow:auto!important;
  max-height:calc(100vh - 168px);
  touch-action:manipulation;          /* native pan, plus our own pinch */
  overscroll-behavior:contain;        /* do not chain into the page */
  -webkit-overflow-scrolling:touch;
}

/* The scaled stage wrapper has to be allowed to be wider than the pane,
   otherwise there is nothing to pan across. */
#questionStage{
  display:block;
  position:relative;
  margin:0 auto;
}

/* On narrow screens the panes stack; a slightly shorter cap keeps the page
   usable and the question still gets its own scroll box. */
@media (max-width:980px){
  body.ial-v030.workspace-mode .questionPaper{
    max-height:76vh;
  }
}

/* ---------------------------------------------------------------------
   2. "Save" in the paper header
   ---------------------------------------------------------------------
   Finishing a paper is the last step and now happens in exactly one place,
   at the bottom of the answer book. The header button saves instead, so it
   has to read as a quiet, reversible action rather than a primary one. */
body.ial-v030 .paperSaveBtn{
  background:#fff!important;
  border:1px solid var(--c-line,#dce2ec)!important;
  color:#31405c!important;
  font-weight:700;
  transition:background .15s,color .15s,border-color .15s;
}
body.ial-v030 .paperSaveBtn:hover{
  background:#f2f5ff!important;
  border-color:#c7d5ff!important;
  color:#315efb!important;
}
body.ial-v030 .paperSaveBtn.isSaved{
  background:#e8f6ee!important;
  border-color:#8fd0ab!important;
  color:#176341!important;
}
@media (max-width:980px){
  body.ial-v030 .paperSaveBtn{display:inline-flex!important}
}

/* ---------------------------------------------------------------------
   3. The single Finish paper, per mode
   ---------------------------------------------------------------------
   "Write on the original paper" hides the answer book, and the bottom
   Finish paper lives inside it. So the header carries the finish action in
   that mode, and only in that mode - one Finish paper is visible at a time,
   always at the end of the flow. */
body.ial-v030 .paperFinishOriginalBtn{
  display:none!important;
}
body.ial-v030.paper-original-workspace .paperFinishOriginalBtn{
  display:inline-flex!important;
}
