.profile-page {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

.profile-app {
  --profile-cta-height: calc(76px + env(safe-area-inset-bottom, 0px));
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  overflow: visible;
}

.profile-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--screen-gutter) 0;
  background: rgb(255 255 255 / 96%);
  backdrop-filter: saturate(160%) blur(14px);
  box-shadow: 0 1px 0 var(--color-divider);
}

.profile-header__back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  color: var(--color-text);
  background: transparent;
  cursor: pointer;
}

.profile-header__back:active {
  background: var(--color-surface);
}

.profile-header__back:disabled {
  visibility: hidden;
}

.profile-header__back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-header__spacer {
  width: 40px;
  height: 40px;
}

.profile-progress {
  display: grid;
  justify-items: center;
  gap: var(--space-1);
}

.profile-progress__label {
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1;
}

.profile-progress__track {
  width: min(100%, 140px);
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-round);
  background: var(--color-divider);
}

.profile-progress__value {
  display: block;
  width: 33.333%;
  height: 100%;
  border-radius: inherit;
  background: var(--color-brand);
}

.profile-content {
  flex: 1;
  overflow: visible;
  padding: 18px var(--screen-gutter) calc(var(--profile-cta-height) + 32px);
}

.profile-stage {
  width: 100%;
}

.profile-stage__intro {
  margin: 0 0 22px;
}

.profile-stage__intro-title,
.profile-stage__intro-text {
  margin: 0;
}

.profile-stage__intro-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.2px;
}

.profile-stage__intro-text {
  max-width: 370px;
  margin-top: 5px;
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.35;
}

.profile-stage__title {
  max-width: 350px;
  margin: 0 0 24px;
  font-size: clamp(27px, 7.2vw, 29px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.65px;
}

.profile-stage--with-intro .profile-stage__title {
  margin-bottom: 24px;
  font-size: clamp(27px, 7.2vw, 29px);
}

.question-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.question-group + .question-group {
  margin-top: 32px;
}

.question-group__title {
  max-width: 360px;
  margin: 0 0 4px;
  padding: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.2px;
}

.question-group__hint {
  margin: 0 0 10px;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.25;
}

.choice-group {
  display: grid;
  gap: 8px;
}

.choice-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
}

.choice-row:active {
  background: var(--color-divider);
}

.choice-row.is-disabled:not(.is-selected) {
  color: var(--color-subtle);
  cursor: default;
}

.choice-row__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.choice-row__control {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-subtle);
  background: var(--color-bg);
}

.choice-row--radio .choice-row__control {
  border-radius: var(--radius-round);
}

.choice-row--checkbox .choice-row__control {
  border-radius: 5px;
}

.choice-row.is-selected .choice-row__control {
  border-color: var(--color-brand);
  background: var(--color-brand);
}

.choice-row--radio.is-selected .choice-row__control::after {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-round);
  background: var(--color-bg);
  content: "";
}

.choice-row--checkbox.is-selected .choice-row__control::after {
  width: 8px;
  height: var(--space-1);
  margin-top: -2px;
  border-bottom: 2px solid var(--color-bg);
  border-left: 2px solid var(--color-bg);
  content: "";
  transform: rotate(-45deg);
}

.choice-row.is-disabled:not(.is-selected) .choice-row__control {
  border-color: var(--color-divider);
  background: var(--color-divider);
}

.choice-row__text {
  font-size: 16px;
  line-height: 1.25;
}

.choice-row.is-selected .choice-row__text {
  font-weight: 500;
}

.profile-cta {
  position: fixed;
  z-index: 200;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 430px;
  min-height: var(--profile-cta-height);
  margin-inline: auto;
  padding: 12px var(--screen-gutter) calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-divider);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: saturate(160%) blur(14px);
}

.profile-cta .primary-button {
  min-height: 52px;
}

.primary-button:active:not(:disabled) {
  filter: brightness(.9);
}

.primary-button:disabled {
  color: var(--color-subtle);
  background: var(--color-divider);
  cursor: default;
}

.secondary-button {
  background: var(--color-surface);
}

.secondary-button:active {
  background: var(--color-divider);
}

.result-screen {
  padding-top: var(--space-1);
}

.result-screen__title {
  max-width: 360px;
  margin: 0 0 var(--space-3);
  font-size: var(--font-display);
  line-height: 1.08;
  letter-spacing: -.65px;
}

.result-screen__description {
  max-width: 360px;
  margin: 0;
  color: var(--color-muted);
  font-size: var(--font-body);
  line-height: 1.35;
}

.result-profile-card {
  margin-top: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.result-details {
  margin: 0;
}

.result-detail + .result-detail {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.result-detail dt {
  margin: 0 0 var(--space-1);
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.25;
}

.result-detail dd {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.2px;
}

.result-detail dd.result-detail__values {
  display: grid;
  gap: var(--space-1);
  font-size: 18px;
}

.result-confirmation {
  margin-top: var(--space-6);
}

.result-confirmation h2 {
  margin: 0 0 var(--space-3);
  font-size: 20px;
  line-height: 1.25;
}

.result-confirmation__actions {
  display: grid;
  gap: var(--space-2);
}

.profile-app.is-result .profile-progress,
.profile-app.is-result .profile-cta {
  display: none;
}

.profile-app.is-result .profile-content {
  overflow: visible;
  padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
}

.profile-page:has(.profile-app.is-result) {
  height: auto;
  min-height: 100dvh;
  overflow-y: auto;
}

.profile-app.is-result {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

@media (max-width: 350px) {
  .profile-content {
    padding-top: 16px;
  }

  .profile-stage__intro {
    margin-bottom: 20px;
  }

  .profile-stage__intro-title {
    font-size: 19px;
  }

  .profile-stage__intro-text {
    font-size: 14.5px;
  }

  .profile-stage__title {
    margin-bottom: 22px;
    font-size: 26px;
  }

  .question-group + .question-group {
    margin-top: 28px;
  }

  .question-group__title {
    font-size: 18px;
  }

  .choice-row {
    gap: 10px;
    min-height: 52px;
    padding: 11px 12px;
  }

  .choice-row__text {
    font-size: 15.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
