/* ── Cube Stack ───────────────────────────────────────────────────────────
   Four cubes stacked into a tower, the side facing you wearing each of the
   game's four colors exactly once — the solved state, which is also the
   whole rule. Colors are the puzzle's own first four
   (public/shared/games/cubestack/cubes.js COLORS: #EF4444 #3B82F6 #22C55E
   #FACC15), in that order, so the tile and the board read as one product.

   Drawn as real cubes rather than four flat bars because the faces you
   *can't* see are the puzzle: the receding right side, darkened the way a
   turned-away face would be, says there is more paint on each of these than
   the column shows. The cap on top takes the game's own accent (#06B6D4,
   gameChooser ACCENTS) rather than a fifth puzzle color, so nothing on the
   tile can be misread as a colour that has to be matched.

   The projection is a plain 45°: depth is 9% of the stage on both axes, so
   the side face's skewY(-45deg) and the cap's skewX(-45deg) meet exactly at
   the far corner with no numbers to keep in sync. */

.game-art--cubestack .ga-cs-cube {
  --y0: 14%;
  position: absolute;
  left: 30%;
  width: 39%;  /* 30% of front face + 9% of receding side */
  height: 19%;
  top: calc(var(--y0) + var(--i) * 20%);
}
.game-art--cubestack .ga-cs-c1 { --i: 0; --c: #EF4444; }
.game-art--cubestack .ga-cs-c2 { --i: 1; --c: #3B82F6; }
.game-art--cubestack .ga-cs-c3 { --i: 2; --c: #22C55E; }
.game-art--cubestack .ga-cs-c4 { --i: 3; --c: #FACC15; }

.game-art--cubestack .ga-cs-front,
.game-art--cubestack .ga-cs-side,
.game-art--cubestack .ga-cs-top {
  position: absolute;
  box-sizing: border-box;
  background: var(--c);
  border: max(1px, 2cqmin) solid rgba(17, 24, 39, 0.5);
}

.game-art--cubestack .ga-cs-front {
  left: 0;
  top: 0;
  width: 77%;   /* the 30 of the wrapper's 39 */
  height: 100%;
}

/* The turned-away face: same paint, less light. Sheared up-and-right from
   the front face's own right edge, so the two share a corner exactly. */
.game-art--cubestack .ga-cs-side {
  left: 77%;
  top: 0;
  width: 23%;   /* the remaining 9 of 39 */
  height: 100%;
  transform: skewY(-45deg);
  transform-origin: 0 100%;
  filter: brightness(0.66);
}

.game-art--cubestack .ga-cs-top {
  --c: #06B6D4;
  left: 30%;
  top: 5%;
  width: 30%;
  height: 9%;
  transform: skewX(-45deg);
  transform-origin: 0 100%;
}

/* Thumbnail tier: nine percent of a 40px stage is three muddy pixels, so the
   depth stops paying for itself — drop it and let four stacked colors carry
   the whole thing, widened to fill the space the tower's side gave back. */
@container ga-stage (max-width: 70px) {
  .game-art--cubestack .ga-cs-side,
  .game-art--cubestack .ga-cs-top { display: none; }
  .game-art--cubestack .ga-cs-cube {
    --y0: 12%;
    left: 26%;
    width: 48%;
  }
  .game-art--cubestack .ga-cs-front { width: 100%; }
}
