Allocation of capital gain on sale of dwelling with an ADU?

I'm confused about tax treatment when selling a house with an ADU that's been rented for years.  Suppose I bought my 1,800 square foot primary residence for $125,000 in 2008.   Today, it has a market value of $300,000.   In 2023 I construct a 600 square foot accessory dwelling unit for $125,000.   

 

Let's say that I sell this property down the road for $550,000, after having depreciated the ADU by $25,000 to a basis of $100,000.

 

Ignoring land value for a moment, how would I allocate the gain on the sale between the house and ADU?  Does it get allocated 50% to each unit, since I paid $125,000 for each of them?  Or maybe 25% to the ADU since it constitutes 1/4 of the total square footage?   Or, even,  $125k/$300k reflecting the percentage of value at the time I build the ADU?  Or...heaven forbid...some other method...

 

I do understand that the depreciation I claim will come back on sale at my ordinary income rate (up to 25%), and I assume this gets subtracted from the ADU"s share of capital gains.

 

Can someone make sense of this?