/* Modal shell */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: block;
  background: var(--modal-bg);
  min-height: var(--app-viewport-height);
  height: var(--app-viewport-height);
  overflow: hidden;
  overflow-anchor: none;
}

.modal-root.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.28), transparent 30%),
    rgba(46, 39, 26, 0.16);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 260ms ease;
}

.quiz-modal {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-height: var(--app-viewport-height);
  height: var(--app-viewport-height);
  padding: 40px 24px;
  background: var(--modal-bg);
  opacity: 0;
  transform: translateY(24px) scale(0.985);
  transition:
    opacity 280ms ease,
    transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overflow-anchor: none;
}

.modal-root.is-open .modal-overlay {
  opacity: 1;
}

.modal-root.is-open .quiz-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.quiz-modal:focus {
  outline: none;
}

.icon-button {
  position: fixed;
  top: 22px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: var(--olive);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: rgba(81, 101, 70, 0.08);
  outline: none;
  transform: scale(1.03);
}

.icon-svg {
  display: block;
}

.icon-button-back {
  position: relative;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border-radius: 999px;
}

.icon-button-close {
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 44px;
  height: 44px;
  padding: 0;
}

.icon-button-close .icon-svg {
  width: 24px;
  height: 24px;
}
.modal-container {
  width: min(844px, 100%);
  margin-inline: auto;
}

.modal-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.modal-content {
  width: 100%;
  margin-block: auto;
}

.transition-screen .modal-content {
  margin-block: 0;
}
body.modal-open {
  overflow: hidden;
}

html.modal-open,
body.modal-open {
  overscroll-behavior: none;
}

body.modal-open::before {
  content: "";
  position: fixed;
  inset: -120px 0;
  z-index: 19;
  background: var(--modal-bg);
  pointer-events: none;
}

body.modal-open.plan-modal-open::before {
  background: transparent;
}

@media (max-width: 760px) {
  .modal-root {
    padding: 0;
  }

  .modal-root.is-pre-result-scroll,
  .modal-root.is-paywall-scroll {
    overflow: hidden;
  }

  .quiz-modal {
    width: 100%;
    height: var(--app-viewport-height);
    min-height: 0;
    padding: 20px 0 var(--mobile-modal-bottom-gap);
    transform: translateY(28px);
    align-items: stretch;
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
  }

  .quiz-modal.is-numeric {
    overflow-y: hidden;
    overscroll-behavior: none;
  }

  .quiz-modal.is-pre-result,
  .quiz-modal.is-paywall {
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  .modal-container {
    width: 100%;
    max-width: none;
  }

  .icon-button {
    top: 18px;
  }

  .icon-button-back {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 999px;
  }

  .icon-button-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    padding: 0;
  }

}
