/* Overlay container */
#leave-site-modal {
  position: fixed;
  inset: 0;
  display: none;                 /* JS toggles to flex */
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
           env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

/* Dim background */
#leave-site-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

/* Dialog */
#leave-site-modal .modal-box {
  position: relative;
  max-width: 520px;
  width: 92%;
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);

  /* Mobile safety: prevent off-screen content */
  max-height: 90vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Actions */
#leave-site-modal .modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  flex-wrap: wrap;               /* allow stacking on narrow screens */
}

/* Buttons: touch-friendly */
#leave-site-modal button {
  cursor: pointer;
  border: 0;
  padding: 0.75rem 1rem;         /* >=44px height on most UIs */
  border-radius: 8px;
  line-height: 1.2;
  min-height: 44px;              /* WCAG touch target */
  font-size: 1rem;               /* avoid iOS zoom */
}

/* Variants */
#cancel-btn { background: #e5e7eb; }
#proceed-btn { background: #111827; color: #fff; }

/* Hover/Focus states (accessibility) */
#leave-site-modal button:hover { filter: brightness(0.95); }
#leave-site-modal button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Extra-small screens */
@media (max-width: 400px) {
  #leave-site-modal .modal-box {
    padding: 0.85rem 1rem;
  }
  #leave-site-modal .modal-actions {
    justify-content: stretch;
  }
  #leave-site-modal .modal-actions button {
    flex: 1 1 100%;              /* stack full-width */
  }
}