Since massive and massless particles are both a form of energy, then is the difference just spatial confinement? I am not asking about symmetry breaking or the mass energy equivalence, or whether elementary particles are made up of other particles, or where rest mass comes from. There are other answers on this site about those, but none of them actually answer my question about massive particles as a manifestation of massless energy being trapped.
I have read this question:

Either way, one can see that a great deal of the "rest mass" in the World indeed arises from the confinement of massless objects, as discussed further in my answer here and here.

Photons inside a box

Indeed, most (if not all - you'd have to get an answer from a field theorist) rest mass is acquired when a massless system such as a herd of photons, initially always running at c is made to "stay put" in some way.
So you can see that the property of rest mass is acquired by certain interactions and changes of state undergone by massless systems. Most generally, it is a coupling co-efficient that measures mutual tethering together of otherwise massless systems.
Another related way to think of rest mass is as a system's "stay-puttedness".

Mass or no mass?

"Coupling", aside from being cross coupling terms in Schrödinger and other quantum state evolution equations, is physically a kind of tethering of particles: they are no longer free to run off at the speed of light but are held back by each other. Even the fundamental particle the electron can be thought of in this way, if you look at my other answer.

Travel at the speed of light

The massless particles mutually partially confine one another, thus begetting the electron's inertia in exactly the same way as the confining resonator made the photon's inertia manifest.

What are good examples to demonstrate Einstein's mass-energy relation
Now my questions is specifically about massive particles, like the electron and quark. Based on these answers, electrons and quarks might just be a manifestation of massless (fields') energy being trapped (confined) somehow in space, thus creating the effect of them having rest mass. As far as I understand, at the beginning of the universe, all particles were massless (like the photon) energy traveling at the speed of light. Somehow, in certain cases this energy got trapped (confined) in space and for certain fields this is interpreted as rest mass.
In other words, this original massless form of energy at the beginning of the universe somehow got trapped (confined in space) and we see this as it manifests in electrons and quarks (and other massive particles)?
I believe both massive and massless particles are just manifestations of the same underlying energy, so is the distinction between them just that one (massless) is propagating free, and the other (massive) is trapped (confined) in space?
Question:

*

*Since massive and massless particles are both a form of energy, then is the difference just spatial confinement?

 A: I think that the answers you quoted are all accurate enough.
There was never a time when all particle types propagated unimpeded at $c$. In the early universe, the particle density was high, and mean free paths were short. As the energy density dropped and matter clumped, most particles still couldn't propagate at $c$ because they couple to the Higgs field, which is nonzero even in vacuum, and/or because they have color charge and the strong force doesn't have any unbound states.
Whether particles are "confined" in the early universe is a matter of definition. Usually confinement implies an inside and an outside and a boundary between them that you can't cross, but in the early universe the "inside" is the entire universe. Because of this, particles are often said to be free in the early universe, and even in lab-made quark-gluon plasma, where there is a boundary but it's very far away.
Whatever you call it, the fact is that most particle types can't under any circumstances travel a macroscopic distance at an average speed of $c$. Rather than saying it's due to confinement, it might be better to say that it's due to interaction, with the Higgs field and/or nearby charged particles.
A: You can see the difference between particles with and without invariant mass looking at the Energy-momentum relation ${E^2}=(pc){^2}+(m_0c^2)^2$.
The total energy $E$ of a particle with zero invariant mass $m_0$ is determined by its momentum $p$. That's why a box filled with photon gas has increased weight.
