/* V34.164 — R37: iPhone/Safari result: native document scroll + action buttons near CTAs.
   Presentation only. Original buttons, scoring, certificate eligibility and click handlers remain intact. */

/* Use the browser's own vertical scroll instead of nested fixed-height modal scrolling.
   A fixed full-height inner modal became inaccessible on some iOS browsers. */
@media (max-width: 760px) {
  /* The result becomes the only visible page; hidden landing-page content cannot
     create a second invisible scroll area below the result. Inputs remain in DOM. */
  body:has(#resultOverlay:not(.hide)) > header,
  body:has(#resultOverlay:not(.hide)) > main#test,
  body:has(#resultOverlay:not(.hide)) > footer,
  body.vp164-page-results > header,
  body.vp164-page-results > main#test,
  body.vp164-page-results > footer {
    display:none!important;
  }
  html:has(#resultOverlay:not(.hide)),
  body:has(#resultOverlay:not(.hide)),
  html.vp164-page-results,
  body.vp164-page-results {
    height:auto!important;
    min-height:100%!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-y:auto!important;
    touch-action:pan-y!important;
  }

  #resultOverlay:not(.hide) {
    position:absolute!important;
    inset:0 0 auto 0!important;
    top:0!important;
    bottom:auto!important;
    display:block!important;
    width:100%!important;
    height:auto!important;
    max-height:none!important;
    min-height:100vh!important;
    min-height:100dvh!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    overflow-x:clip!important;
    align-items:initial!important;
    justify-content:initial!important;
    overscroll-behavior:auto!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
    background:#fff!important;
  }

  #resultOverlay:not(.hide) #resultArea.result-card {
    box-sizing:border-box!important;
    display:block!important;
    position:static!important;
    inset:auto!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    max-height:none!important;
    min-height:100vh!important;
    min-height:100dvh!important;
    overflow:visible!important;
    overflow-y:visible!important;
    overflow-x:clip!important;
    overscroll-behavior:auto!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
    padding:16px 14px calc(40px + env(safe-area-inset-bottom))!important;
    margin:0!important;
    border-radius:0!important;
    background:#fff!important;
    box-shadow:none!important;
  }

  /* All original document/actions buttons move directly below the free session / exam CTAs.
     Do not create copy-buttons: existing event listeners stay attached to same DOM nodes. */
  #resultOverlay:not(.hide) #resultArea .vp164-actions-heading,
  #resultOverlay:not(.hide) #resultArea .vp163-actions-heading {
    display:block!important;
    width:100%!important;
    max-width:900px!important;
    padding:13px 2px 6px!important;
    margin:13px auto 0!important;
    border-top:1px solid #e1e7ee!important;
    color:#172a47!important;
    font-weight:850!important;
    font-size:16px!important;
    line-height:1.3!important;
    text-align:left!important;
  }
  #resultOverlay:not(.hide) #resultArea .vp-result-actions {
    box-sizing:border-box!important;
    position:static!important;
    inset:auto!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
    justify-items:stretch!important;
    align-items:stretch!important;
    width:100%!important;
    max-width:900px!important;
    margin:0 auto 14px!important;
    padding:8px 0 10px!important;
    overflow:visible!important;
    background:#fff!important;
    box-shadow:none!important;
    border-top:0!important;
    z-index:auto!important;
  }
  #resultOverlay:not(.hide) #resultArea .vp-result-actions > button,
  #resultOverlay:not(.hide) #resultArea .vp-result-actions > a {
    box-sizing:border-box!important;
    position:static!important;
    display:flex!important;
    flex-direction:row!important;
    justify-content:center!important;
    align-items:center!important;
    min-width:0!important;
    max-width:none!important;
    width:100%!important;
    min-height:49px!important;
    height:auto!important;
    margin:0!important;
    padding:10px 8px!important;
    font-size:13px!important;
    line-height:1.3!important;
    white-space:normal!important;
    overflow-wrap:break-word!important;
    text-align:center!important;
    border-radius:11px!important;
    visibility:visible!important;
    opacity:1!important;
  }
  /* Preserve hidden condition-driven certificates (we do not change eligibility). */
  #resultOverlay:not(.hide) #resultArea .vp-result-actions > [hidden],
  #resultOverlay:not(.hide) #resultArea .vp-result-actions > .hide,
  #resultOverlay:not(.hide) #resultArea .vp-result-actions > [style*="display:none"],
  #resultOverlay:not(.hide) #resultArea .vp-result-actions > [style*="display: none"] {
    display:none!important;
  }
  #resultOverlay:not(.hide) #resultArea .vp163-actions-jump {
    display:none!important;
  }
  #resultOverlay:not(.hide) #resultArea .vp-result-actions > :last-child:not([hidden]):not(.hide) {
    grid-column:1 / -1!important;
  }
  #resultOverlay:not(.hide) #resultArea .vp162-primary-conversion {
    width:100%!important;
    max-width:900px!important;
    margin:14px auto 10px!important;
  }
}
@media(max-width:355px) {
  #resultOverlay:not(.hide) #resultArea .vp-result-actions {
    grid-template-columns:minmax(0,1fr)!important;
  }
}
