This may be ridged enough, however I would recommend going with a torsion box design. This is how a professional furniture maker would attempt this. You can use 2x4 for the "core" and two skins of 3/4 inch ply. I would put a perimeter of 2x4 around the core (not shown in the picture) then lag bold the perimeter into your studs. You may have to cut a hole in the bottom skin to make this work. The key to making this work is to glue (subfloor adhesive) and screw (2") the skins to the core. Woodworkers have been using torsion boxes for years to create large desktops.
If you are using standard 8' plywood for the skins you will probably want to stagger the seams between the bottom and the top tortion box. For instance in the top use 2 7' pieces of ply. In the bottom skin use a 3' a 8' and a 3' piece of ply.
This will probably be your safest best. After you build it and before you install it you can test it out with two saw horses. I would be very surprised if it did not hold 200 lbs or more.
if you are still worried about flexing move up from a 2x4 to a 2x6 for the core and you should be able to support several people standing on it.
Considering that you have a relatively high sideboard/headboard and footboard arrangement, that can be used to help strengthen the headers around the perimeter. The strength of a piece of 3/4" plywood, 21 plus inches tall on the sides alone with a small ledger to support the joists and bed slats is sufficient if all is glued and screwed together and has a sufficient bearing surface, 1" is ample.
Since it is for sleeping, typically at most for two people, and if you have kids too, the bed would need to hold say only the weight of 4 to 6 people, then add a little more to cover murphy's law so the weight of 2 adults and 4 kids may run about 700 lbs., let's take that to 1000 lbs., kids jump up and down.
The bed you have at nearly a 7 ft average on both sides will yield 49 sq ft, multiply that by 40 lbs/sq ft and it will carry 1960 lbs. a little overkill but ok. So the live load using the AWC calculator at 7 lbs dead load and 30 lbs live load at 16 inch centers you can use 2X6's and still carry a 10+ span with SPF or 8+ with D Fir, plenty strong.... The same calculator gives a recommendation for the bearing ends of .30 or so of an inch, Don't be fooled on what an inch of bearing can do. I would expect if you mortise the ends in and secure it with a screws (gauge your screw length properly for end grain) It will do all you expect.
The matter at hand is the headers at either end, I had supposed the side boards etc., were to be fixed permanently to keep the occupants safe, therefore I was going to use that as part of the structure too to keep the bulk of everything down. If they are to be hinged or drop down then the header will need to work on its own, I would suggest using a 2X8 for the perimeter, mortise and tenoned for shear strength and use a captured nut with bolt to draw the joints together. That with the face of the 2X8 against the faces of the legs will give a lot of lateral resistance. For your own investigation, and practice on making this critical connection, make a sample joint and put it to the test.
I have used this type of connector to hold a 7 ft wide 4 ft tall gate out of 2 inch thick solid mahogany using standard bolts and site made washers to fit the slot for the nut- Four 1/2 inch bolts were used for this, still hanging after eight years outside
Just as a mention, and you may know this already, the AWC calculator is for home building, quite the different animal than furniture making.
Reread your comment and missed a point, if the mortices were not all the way through and the bottom of the mortice was 2 inches plus above the bottom of the header with no knots or curly grain, it will not weaken the header enough to cause concern. Give a look at some of the beds at places like Ikea or Crate and Barrel, or something like that....
Best Answer
You will likely experience some bounce using a 2x4 joist even when on 12" centers. I would suggest 2x6 on 12" centers for a nice solid platform floor.
With only a 5'6" width of the platform I think you will have tight work area up there considering a desk on the wall. If the desk is on the long wall I say you have a non-starter situation. If the desk is on the short wall then maybe it is usable but do add a safety railing to the open edge so you do not accidentally fall off. A six foot drop could be downright painful.