.btn-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnspin 0.6s linear infinite;
  vertical-align: middle;
  margin-inline-start: 0.5rem;
}

@keyframes btnspin {
  to {
    transform: rotate(360deg);
  }
}

button.loading {
  pointer-events: none;
  opacity: 0.85;
}

button.loading .btn-label {
  opacity: 0.7;
}

button:not(.loading) .btn-spinner {
  display: none;
}

/* Enable smooth momentum scrolling on mobile and ensure extra bottom space */
.terms-content-container {
  -webkit-overflow-scrolling: touch;
  /* fallback padding in case Tailwind classes are not applied */
  padding-bottom: 1.5rem;
}

/* Small-screen tweaks: keep modal scrollable and actions reachable */
@media (max-width: 871px) {
  #modal-overlay {
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  #modal-dialog {
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }

  #terms-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 50vh;
    font-size: 0.95rem;
    padding-bottom: 1rem;
  }

  #agree-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
    margin-top: 0;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.06);
    border-top: 1px solid #e5e7eb;
    width: 100%;
  }

  #agree-btn {
    width: 100%;
    max-width: none;
    margin-bottom: 0;
  }

  /* Respect the hidden state on load; only show expanded content after click */
  #expanded-view {
    display: none;
  }

  #expanded-view:not(.hidden) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }
}
