Phenotypic variation within populations has two sources: genetic variation and environmental variation. Here, we investigate the coevolution of these two components under fluctuating selection. Our analysis is based on the lottery model in which genetic polymorphism can be maintained by negative frequency-dependent selection, whereas environmental variation can be favored due to bet-hedging. In our model, phenotypes are characterized by a quantitative trait under stabilizing selection with the optimal phenotype fluctuating in time. Genotypes are characterized by their phenotypic offspring distribution, which is assumed to be Gaussian with heritable variation for its mean and variance. Polymorphism in the mean corresponds to genetic variance while the width of the offspring distribution corresponds to environmental variance. We show that increased environmental variance is favored whenever fluctuations in the selective optima are sufficiently strong. Given the environmental variance has evolved to its optimum, genetic polymorphism can still emerge if the distribution of selective optima is sufficiently asymmetric or leptokurtic. Polymorphism evolves in a diagonal direction in trait space: one type becomes a canalized specialist for the more common ecological conditions and the other type a de-canalized bet-hedger thriving on the less-common conditions. All results are based on analytical approximations, complemented by individual-based simulations.