/* Keep all five profile-type choices visible together without inner scrolling. */
.matching-dialog .profile-dialog-panel:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) {
  height: min(100dvh, 640px);
  max-height: 100dvh;
}

.matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 12px;
}

.matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-step {
  display: block;
  margin: 0;
}

.matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) h2 {
  margin: 0;
}

.matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-options {
  min-height: 0;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-card {
  min-height: 0;
  height: 100%;
  padding-top: 8px;
  padding-bottom: 8px;
}

@media (max-width: 767px) {
  .matching-dialog .profile-dialog-panel:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) {
    height: 100dvh;
    max-height: 100dvh;
    grid-template-rows: 96px minmax(0, 1fr) auto;
    border-radius: 0;
  }

  .matching-dialog .profile-dialog-panel:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child)::before {
    display: none;
  }

  .matching-dialog .profile-dialog-panel:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-head {
    min-height: 96px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: 12px;
  }

  .matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) {
    gap: 8px;
    padding: 10px 16px;
  }

  .matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-options {
    gap: 8px;
  }

  .matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-card {
    padding: 6px 14px;
  }
}

@media (max-width: 767px) and (max-height: 620px) {
  .matching-dialog .profile-dialog-panel:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) {
    grid-template-rows: 80px minmax(0, 1fr) auto;
  }

  .matching-dialog .profile-dialog-panel:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-head {
    min-height: 80px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }

  .matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) {
    gap: 5px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-options {
    gap: 5px;
  }

  .matching-flow-body:has(.matching-flow-options > .matching-flow-card:nth-child(5):last-child) .matching-flow-card {
    padding-top: 3px;
    padding-bottom: 3px;
  }
}
