/* The 3D board view (prototype) shared by several games: see shell/tilt3d.js. A board with `t3-board is-3d` leans
   back under a mild perspective; `.t3-box` elements (tilt3d.js box) stand on it, lit from the top and a little from
   the front. A container of boxes sets --u, the px of one box unit (a hundredth of the container). Face colours
   come from --top and the optional --top-face, --t3-side and --t3-side-x (prefixed: the landscape shell has its
   own --side). Tappable cells lying in the same plane as a painted board behind them need a small lift
   (translateZ(1px)), or the browser may hit-test the board in their place. */
:root {
  --t3-shadow: rgb(0 0 0 / 0.28);
  --t3-slab: #8c8a84;
  --t3-slab-edge: #6f6d68;
}
:root[data-theme='dark'] {
  --t3-shadow: rgb(0 0 0 / 0.5);
  --t3-slab: #3e3e46;
  --t3-slab-edge: #2c2c33;
}
.t3-board.is-3d {
  transform: scale(var(--t3-scale, 1)) perspective(var(--t3-depth, 1200px)) rotateX(38deg);
  transform-style: preserve-3d;
}
/* The board's front edge: a slab under the bottom row (a board can turn it off with --t3-slab-h: 0). */
.t3-board.is-3d::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: var(--t3-slab-h, calc(var(--t3-cell, 48px) * 0.22));
  background: linear-gradient(var(--t3-slab), var(--t3-slab-edge));
  border-radius: 0 0 6px 6px;
  transform-origin: top;
  transform: rotateX(-90deg);
  pointer-events: none;
}
/* Everything between the board and its boxes keeps the 3D space. */
.t3-board.is-3d .t3-keep {
  transform-style: preserve-3d;
}
.t3-box {
  display: none;
}
.t3-board.is-3d .t3-box {
  display: block;
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  height: calc(var(--l) * 1%);
  transform: translateZ(calc(var(--z) * var(--u, 0.5px)));
  transform-style: preserve-3d;
  pointer-events: none;
}
.t3-box > i {
  position: absolute;
  display: block;
  backface-visibility: hidden;
  border-radius: var(--t3-round, 0);
}
.t3-box > .t {
  inset: 0;
  background: var(--top-face, var(--top));
  transform: translateZ(calc(var(--h) * var(--u, 0.5px)));
}
.t3-box > .s,
.t3-box > .n {
  left: 0;
  right: 0;
  height: calc(var(--h) * var(--u, 0.5px));
  background: var(--t3-side, color-mix(in srgb, var(--top) 72%, #000));
}
.t3-box > .s {
  bottom: 0;
  transform-origin: bottom;
  transform: rotateX(-90deg);
}
.t3-box > .n {
  top: 0;
  transform-origin: top;
  transform: rotateX(90deg);
}
.t3-box > .e,
.t3-box > .w {
  top: 0;
  bottom: 0;
  width: calc(var(--h) * var(--u, 0.5px));
  background: var(--t3-side-x, color-mix(in srgb, var(--top) 84%, #000));
}
.t3-box > .e {
  right: 0;
  transform-origin: right;
  transform: rotateY(90deg);
}
.t3-box > .w {
  left: 0;
  transform-origin: left;
  transform: rotateY(-90deg);
}
/* A soft round shadow on the floor under a standing piece. */
.t3-board.is-3d .t3-shadow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--t3-shadow), transparent);
  transform: translateZ(0.5px);
  pointer-events: none;
}
