I'm not next to the comp but I'll show you what looks odd visually when I get a chance.
Nice cliffhanger btw.
In the meanwhile I sum up:
Preliminary draft
The effective cost is calculated & LOCKED IN upon placing down a district, even if the production is changed immediately and many other things are actually built before the district on purpose.
(67 Techs & 51 Civics in game, rounding down)
District cost = 60* (1 + 9*[ 100*Larger of{ Number of Techs/67 OR Number of Civics/51 } ]/100)
- Aqueduct 50, max 500
- normal districts max 600
- district types rarely used max 450 (@25% discount)
Aqueduct, Neighborhood and Spaceport don't receive discounts ("diversity of your districts" not applicable, because victory type respectively map specific or just style of play). So Aerodrome, Campus, Commercial Hub, Encampment, Entertainment Complex, Harbor, Holy Site, Industrial Zone & Theater Square can receive the 25% discount.
TBD "less than average" is calculated by adding all completed and/or uncompleted districts of this types _you_ have and then dividing by the number of districts types _you_ have currently available (depending on techs & civics).
To avoid, that if you have just one completed district all other district types would be at reduced price, at least 3 completed districts (different or same) are needed to get discounts. Also having more districts underway than completed inhibits the discount.
Discounts are turned ON based on completed districts and triggered by the completion of techs / civics or finishing districts.
Discounts are turned OFF based on completed+uncompleted districts and triggered by the completion of techs / civics or placing districts.