/* Final mobile polish for saga explorer: centered modal + clean ending before footer. */

@media (max-width: 680px) {
  body.page-saga-tool {
    overflow-x: hidden;
  }

  body.page-saga-tool .page-view--tool {
    padding-top: 22px;
    padding-bottom: 42px;
  }

  body.page-saga-tool .page-view--tool > .container {
    width: min(100% - 24px, 680px);
    max-width: min(100% - 24px, 680px);
    margin-inline: auto;
  }

  body.page-saga-tool .saga-tool__seo {
    width: min(100%, 640px);
    margin: 30px auto 46px;
    padding: 30px 22px 24px;
    border-radius: 24px;
  }

  body.page-saga-tool .saga-tool__seo h2 {
    font-size: clamp(30px, 9.2vw, 42px);
    line-height: .98;
  }

  body.page-saga-tool .saga-tool__seo p {
    font-size: 16px;
    line-height: 1.62;
  }

  body.page-saga-tool .saga-tool__links {
    gap: 12px;
    margin-top: 20px;
  }

  body.page-saga-tool .saga-tool__links a {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
  }

  body.page-saga-tool .saga-modal {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(calc(100vw - 36px), 540px);
    max-width: min(calc(100vw - 36px), 540px);
    max-height: min(74dvh, 620px);
    margin: 0;
    border-radius: 26px;
    overscroll-behavior: contain;
  }

  body.page-saga-tool .saga-modal__card {
    max-height: min(74dvh, 620px);
    padding: 58px 18px 22px;
  }

  body.page-saga-tool .saga-modal__card img {
    max-height: 145px;
    margin-inline: auto;
    margin-bottom: 16px;
    padding: 12px;
  }

  body.page-saga-tool .saga-modal__close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  body.page-saga-tool .saga-modal__card h2 {
    font-size: clamp(28px, 8.4vw, 36px);
    line-height: 1.02;
  }

  body.page-saga-tool .saga-modal__card p {
    font-size: 15px;
    line-height: 1.46;
  }

  body.page-saga-tool .site-footer {
    margin-top: 0;
    padding-top: 42px;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  body.page-saga-tool .site-footer .container {
    width: min(100% - 64px, 560px);
    max-width: min(100% - 64px, 560px);
    margin-inline: auto;
  }

  body.page-saga-tool .footer-col-brand,
  body.page-saga-tool .footer-col,
  body.page-saga-tool .bottom-info {
    text-align: center;
  }

  body.page-saga-tool .footer-brand-tagline {
    max-width: 20ch;
    margin-inline: auto;
  }

  body.page-saga-tool .footer-news-btn {
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
  }

  body.page-saga-tool .footer-social-block {
    margin-top: 28px;
  }

  body.page-saga-tool .footer-links {
    justify-items: center;
  }
}

@supports (height: 100svh) {
  @media (max-width: 680px) {
    body.page-saga-tool .saga-modal {
      max-height: min(74svh, 620px);
    }

    body.page-saga-tool .saga-modal__card {
      max-height: min(74svh, 620px);
    }
  }
}
