/* V34.163 – R36 : align CTAs and restore usable scrolling/actions on phones. */

/* ROOT CAUSE: v34.161 had #resultArea{overflow:visible!important}, which beat
   the scrolling .result-card declaration. Consequently the action footer fell
   outside the modal/phone viewport. A higher-specificity rule restores a single
   self-contained scroll container, without touching test or certificate logic. */
#resultOverlay.vp163-modern #resultArea.result-card {
  box-sizing:border-box!important;
  display:block!important;
  width:min(1080px,calc(100vw - 36px))!important;
  max-width:1080px!important;
  max-height:calc(100dvh - 36px)!important;
  height:auto!important;
  min-height:0!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior-y:contain!important;
  -webkit-overflow-scrolling:touch!important;
  scrollbar-gutter:stable!important;
  position:relative!important;
}
#resultOverlay.vp163-modern #resultArea.result-card * {
  box-sizing:border-box;
}
#resultOverlay.vp163-modern #resultArea.result-card > * {
  max-width:100%;
}

/* CTA CARDS: equal heights and bottom-aligned buttons, preserving every word
   and the original API handlers. The exam note is shown above its button. */
#resultOverlay.vp163-modern .vp162-primary-conversion {
  display:grid!important;
  width:min(100%,900px)!important;
  gap:14px!important;
  align-items:stretch!important;
  justify-items:stretch!important;
  grid-auto-rows:auto!important;
}
#resultOverlay.vp163-modern .vp162-primary-conversion.vp162-two-actions {
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
#resultOverlay.vp163-modern .vp162-primary-conversion > .vp-free-session-cta,
#resultOverlay.vp163-modern .vp162-primary-conversion > .vp112-result-prep {
  box-sizing:border-box!important;
  display:flex!important;
  flex-direction:column!important;
  justify-content:flex-start!important;
  align-items:stretch!important;
  align-self:stretch!important;
  min-width:0!important;
  width:100%!important;
  min-height:205px!important;
  height:100%!important;
  padding:17px!important;
  margin:0!important;
  gap:10px!important;
}
#resultOverlay.vp163-modern .vp162-primary-conversion > .vp-free-session-cta > div {
  flex:1 1 auto!important;
  min-width:0!important;
}
#resultOverlay.vp163-modern .vp162-primary-conversion > .vp112-result-prep > small {
  order:0!important;
  display:flex!important;
  flex:1 1 auto!important;
  align-items:center!important;
  justify-content:center!important;
  min-height:30px!important;
  margin:0!important;
  padding:0 6px!important;
  text-align:center!important;
  line-height:1.45!important;
}
#resultOverlay.vp163-modern .vp162-primary-conversion > .vp-free-session-cta > #vpFreeLanguageSession,
#resultOverlay.vp163-modern .vp162-primary-conversion > .vp112-result-prep > .vp112-form-link {
  box-sizing:border-box!important;
  order:1!important;
  display:flex!important;
  flex:0 0 auto!important;
  align-items:center!important;
  justify-content:center!important;
  width:100%!important;
  min-width:0!important;
  min-height:54px!important;
  margin:auto 0 0!important;
  padding:10px 12px!important;
  border-radius:13px!important;
  line-height:1.35!important;
  text-align:center!important;
  white-space:normal!important;
  overflow-wrap:break-word!important;
}

/* Actions are within the result scroll container, never in a clipped footer. */
#resultOverlay.vp163-modern #resultArea .vp163-actions-heading {
  width:min(100%,900px)!important;
  max-width:900px!important;
  margin:20px auto 0!important;
  padding:12px 2px 6px!important;
  border-top:1px solid #e0e6ef!important;
  color:#172a47!important;
  font-size:16px!important;
  font-weight:850!important;
  line-height:1.3!important;
  text-align:left!important;
}
#resultOverlay.vp163-modern #resultArea .vp-result-actions {
  box-sizing:border-box!important;
  position:static!important;
  inset:auto!important;
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  align-items:stretch!important;
  justify-items:stretch!important;
  width:min(100%,900px)!important;
  max-width:900px!important;
  gap:9px!important;
  margin:0 auto!important;
  padding:8px 0 14px!important;
  background:transparent!important;
  box-shadow:none!important;
  border-top:0!important;
  overflow:visible!important;
  z-index:auto!important;
}
#resultOverlay.vp163-modern #resultArea .vp-result-actions > button,
#resultOverlay.vp163-modern #resultArea .vp-result-actions > a {
  box-sizing:border-box!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  min-height:46px!important;
  height:auto!important;
  margin:0!important;
  padding:10px 9px!important;
  font-size:12.5px!important;
  line-height:1.35!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  text-align:center!important;
}
/* Never expose a certificate that the application's eligibility logic hides. */
#resultOverlay.vp163-modern #resultArea .vp-result-actions > [hidden],
#resultOverlay.vp163-modern #resultArea .vp-result-actions > .hide,
#resultOverlay.vp163-modern #resultArea .vp-result-actions > [style*="display:none"],
#resultOverlay.vp163-modern #resultArea .vp-result-actions > [style*="display: none"] {
  display:none!important;
}
#resultOverlay.vp163-modern #resultArea .vp163-actions-jump {
  display:none!important;
}
#resultOverlay.vp163-modern #resultArea .vp-result-actions :is(button,a):focus-visible,
#resultOverlay.vp163-modern #resultArea .vp162-primary-conversion :is(button,a):focus-visible,
#resultOverlay.vp163-modern #resultArea .vp163-actions-jump:focus-visible {
  outline:3px solid #143b81!important;
  outline-offset:2px!important;
}

@media (max-width:760px) {
  #resultOverlay.vp163-modern {
    align-items:stretch!important;
    justify-content:stretch!important;
    padding:0!important;
    overflow:hidden!important;
  }
  #resultOverlay.vp163-modern #resultArea.result-card {
    width:100%!important;
    max-width:100%!important;
    min-height:0!important;
    height:100vh!important;
    height:100dvh!important;
    max-height:100vh!important;
    max-height:100dvh!important;
    padding:14px 14px max(24px,env(safe-area-inset-bottom))!important;
    border-radius:0!important;
    box-shadow:none!important;
    scrollbar-gutter:auto!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }
  #resultOverlay.vp163-modern .vp162-primary-conversion,
  #resultOverlay.vp163-modern .vp162-primary-conversion.vp162-two-actions {
    grid-template-columns:minmax(0,1fr)!important;
    gap:11px!important;
    margin:13px auto 8px!important;
  }
  #resultOverlay.vp163-modern .vp162-primary-conversion > .vp-free-session-cta,
  #resultOverlay.vp163-modern .vp162-primary-conversion > .vp112-result-prep {
    min-height:0!important;
    height:auto!important;
    padding:14px!important;
    gap:9px!important;
  }
  #resultOverlay.vp163-modern .vp162-primary-conversion > .vp112-result-prep > small {
    flex:0 1 auto!important;
    margin:3px 0 0!important;
  }
  #resultOverlay.vp163-modern .vp162-primary-conversion > .vp-free-session-cta > #vpFreeLanguageSession,
  #resultOverlay.vp163-modern .vp162-primary-conversion > .vp112-result-prep > .vp112-form-link {
    min-height:50px!important;
    font-size:14px!important;
    margin:0!important;
  }
  #resultOverlay.vp163-modern #resultArea .vp163-actions-jump {
    display:flex!important;
    width:min(100%,900px)!important;
    margin:8px auto 14px!important;
    padding:10px 12px!important;
    min-height:40px!important;
    justify-content:center!important;
    align-items:center!important;
    gap:6px!important;
    color:#173861!important;
    background:#eff5fc!important;
    border:1px solid #cfdaeb!important;
    border-radius:12px!important;
    font-size:13px!important;
    font-weight:800!important;
    text-decoration:none!important;
  }
  #resultOverlay.vp163-modern #resultArea .vp163-actions-heading {
    font-size:15px!important;
    margin-top:19px!important;
  }
  #resultOverlay.vp163-modern #resultArea .vp-result-actions {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    padding:8px 0 26px!important;
  }
  #resultOverlay.vp163-modern #resultArea .vp-result-actions > button,
  #resultOverlay.vp163-modern #resultArea .vp-result-actions > a {
    min-height:48px!important;
    font-size:12.5px!important;
    padding:10px 8px!important;
  }
  #resultOverlay.vp163-modern #resultArea .vp-result-actions > :last-child:not([hidden]):not(.hide) {
    grid-column:1 / -1!important;
  }
}
@media (max-width:345px) {
  #resultOverlay.vp163-modern #resultArea .vp-result-actions {
    grid-template-columns:minmax(0,1fr)!important;
  }
}

/* A1/A2: one booking card should stay compact, never look like a blank column. */
#resultOverlay.vp163-modern .vp162-primary-conversion:not(.vp162-two-actions) > .vp-free-session-cta {
  min-height:0!important;
}
/* Tablet: stack the two cards rather than allow cramped unequal-looking CTAs. */
@media (min-width:761px) and (max-width:840px) {
  #resultOverlay.vp163-modern .vp162-primary-conversion.vp162-two-actions {
    grid-template-columns:minmax(0,1fr)!important;
  }
  #resultOverlay.vp163-modern .vp162-primary-conversion > .vp-free-session-cta,
  #resultOverlay.vp163-modern .vp162-primary-conversion > .vp112-result-prep {
    min-height:0!important;
  }
}
