.kg-hs-modal {
  width: min(960px, calc(100vw - 32px));
  max-width: 960px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #080808;
  color: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .42);
  font-family: Montserrat, Arial, sans-serif;
}

.kg-hs-modal::backdrop {
  background: rgba(4, 5, 6, .76);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.kg-hs-modal__shell {
  position: relative;
  max-height: calc(100dvh - 32px);
}

.kg-hs-modal__title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.kg-hs-modal__close {
  position: absolute;
  z-index: 5;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111318;
  font: 400 28px/1 Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .2);
  transition: background-color .2s ease, transform .2s ease;
}

.kg-hs-modal__close:hover,
.kg-hs-modal__close:focus-visible {
  background: #fff32a;
  outline: 2px solid #111318;
  outline-offset: 2px;
  transform: scale(1.05);
}

.kg-hs-modal__scroll {
  position: relative;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #080808;
  -webkit-overflow-scrolling: touch;
}

.kg-hs-modal__loading {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 150px;
  color: #fff;
  font-size: .86rem;
  font-weight: 600;
  text-align: center;
}

.kg-hs-modal__spinner {
  width: 22px;
  height: 22px;
  flex: none;
  border: 3px solid #595959;
  border-top-color: #fff32a;
  border-radius: 50%;
  animation: kg-hs-spin .8s linear infinite;
}

.kg-hs-modal.is-loaded .kg-hs-modal__loading { display: none; }

.kg-hs-modal .hs-form-frame {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 360px;
}

.kg-hs-modal .hs-form-frame iframe {
  display: block;
  width: 100% !important;
  max-width: 100%;
  border: 0;
}

body.kg-hs-modal-open {
  position: fixed;
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
}

@keyframes kg-hs-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .kg-hs-modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .kg-hs-modal__shell,
  .kg-hs-modal__scroll { max-height: calc(100dvh - 24px); }
  .kg-hs-modal__close { top: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .kg-hs-modal__spinner { animation-duration: 1.8s; }
  .kg-hs-modal__close { transition: none; }
}
