tl;dr I think you're right and your textbook is wrong. It would be interesting to know (a) what textbook this is (maybe it's the same as the one I quote below?) and (b) what your teacher says if you ask them this question.
In general the energy content of a trophic level is roughly proportional to its biomass (although in going from terrestrial plants to animals we might expect the energy/gram to increase, since terrestrial plants contain a lot of energy-poor structural material). Both energy and biomass would also be proportional to numbers if individuals in each trophic level were approximately the same size (this can go in either direction; whales are much bigger than the plankton they eat, beavers are much smaller than the trees they eat ...)
For oceanic phytoplankton and zooplankton respectively, some reasonable mass/energy conversions are phytoplankton: 2-3 calories per milligram (cal/mg) dry weight (Platt and Irwin 1973); zooplankton: 3-9 cal/mg dry weight (Davis 1993). (ZP are about 3x more energy-rich than PP.)
In my view energy pyramids as well as number pyramids can be inverted, despite what this open-source biology textbook (ref below) says:
Pyramids of energy are always upright, since energy is lost at each trophic level; an ecosystem without sufficient primary productivity cannot be supported.
As detailed below, I think this statement is wrong. The energy loss tends to make energy pyramids a little bit less top-heavy than biomass pyramids, but they can be inverted for exactly the same reason that biomass pyramids can.
The book shows an inverted biomass pyramid:
And explains it as follows:
However, the phytoplankton in the English Channel example make up less biomass than the primary consumers, the zooplankton. As with inverted pyramids of numbers, the inverted biomass pyramid is not due to a lack of productivity from the primary producers, but results from the high turnover rate of the phytoplankton. The phytoplankton are consumed rapidly by the primary consumers, which minimizes their biomass at any particular point in time. However, since phytoplankton reproduce quickly, they are able to support the rest of the ecosystem.
This argument should apply equally well to energy.
In other words, the amount of biomass or energy present in the lower trophic level (phytoplankton) at any moment in time (also called the stock or standing stock) is less than the energy present in the upper trophic level (zooplankton), but the flow of energy is constant (minus losses due to conversion inefficiency).
In particular, if we take the English Channel values (4 g dry mass/m^2 PP; 21 g/m^2 ZP) and convert (g/m^2 * (1000*cal/mg) = cal/m^2) we get at most 3*4*1000 = 12000 cal/m^2 for PP and at least 3*21*1000 = 63000 cal/m^2 for ZP, so the pyramid is still inverted. (In fact, since ZP are generally more energy-rich than PP we would expect the energy pyramid to be more top-heavy than the biomass PP; here I have used the most conservative numbers possible, the top end of the range for PP content and the bottom for ZP content, which happen to be the same.)
For example, suppose individual phytoplankters (yes, that's the word for an individual organism in the phytoplankton) and zooplankters are the same size/contain the same amount of energy (not true, but an OK simplification here), and that there are 10,000 phytoplankters and 90,000 zooplankters per cubic meter of water. The phytoplankters reproduce so fast that each ZP can eat 10 PP over the course of its lifetime without depleting the PP population. In one ZP generation (= 10 PP generations), 100,000 units of energy come into the PP (through photosynthesis) and are eaten by ZP (with a 10% loss due to trophic inefficiency); that's enough to maintain 90,000 zooplankters.
Ecosystems. (2021, March 6). Retrieved September 3, 2021, from https://bio.libretexts.org/@go/page/12640
Davis, Nancy D. “Caloric Content of Oceanic Zooplankton and Fishes for Studies of Salmonid Food Habits and Their Ecologically Related Species.” Fisheries Research Institute, University of Washington, 1993. https://digital.lib.washington.edu/researchworks/bitstream/handle/1773/4192/9312.pdf?sequence=1.
Platt, Trevor, and Brian Irwin. “Caloric Content of Phytoplankton.” Limnology and Oceanography 18, no. 2 (1973): 306–10. https://doi.org/10.4319/lo.1973.18.2.0306.