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qJfPdPqE+OM1NrS7633nrrrbfeeuuWeU9QaHO4qmcGb4Z0coODAgiTHq/7XUEC6FB14i2uWVseeU8aAX5n6GwEpACTRoAE8BLoRATw5NjwuSLPHQ2JUtoI1QapX5ezLTFXb5VJ0ALwcDUPWRkh3CmmALl7zH5Kcx4zMxL3wWqeMpfg43gR4nkiy1nHNOcxM+NROb8dYPjnNwXsk+/y48K/n/VG7iHkXgI5bMtSgCRrTztCEnm+n6c9JahPzmNmxuMzLoNxvi/QqZMJlU53mqA+OY+ZWekoLc8V85id/enVccgbOY+ZWRJUeZLvCzovQBLiAWuJsFJHhvK55pNoE3IeMzOGOkmWCJeQAowjwlzdA0yWpDb7viBB4rwZJmmSn6t/gc2+LxAcCULp+wKu/63I70QE/AMDdqWZ7rX6YgAAAABJRU5ErkJggg==");
}

/* TODO: Outer layers for each limb */
:host {
  --mc-height: 320px;
  --mc-skin: var(--mc-steve-skin);
  display: block;
  position: relative;
  perspective: 1000px;
  width: calc(var(--mc-height) / 2);
  height: var(--mc-height);
  margin: 0;
  padding: 0;
  perspective-origin: calc(var(--mc-height) / 3);
}

:host([slim]) {
  --mc-skin: var(--mc-alex-skin);
}

.cuboid {
  width: var(--rect-width);
  height: var(--rect-height);
  transform-style: preserve-3d;
  box-sizing: border-box;
  position: relative;
  image-rendering: pixelated;
  transform: rotateX(var(--mc-rotate-y, 0deg)) rotateY(var(--mc-rotate-x, 0deg));
  transform-origin: 50% 50%;
}

.cuboid .face {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(
      0deg,
      rgba(70, 70, 70, 0.2) 0px,
      rgba(70, 70, 70, 0.2) 1px,
      transparent 1px,
      transparent 21px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(70, 70, 70, 0.2) 0px,
      rgba(70, 70, 70, 0.2) 1px,
      transparent 1px,
      transparent 21px
    ),
    linear-gradient(90deg, rgb(255, 255, 255), rgb(255, 255, 255));
  background-size: 100%;
  background-repeat: no-repeat;
  transform-origin: 50% 50%;
  image-rendering: pixelated;
  top: 50%;
  left: 50%;
  position: absolute;
}

.cuboid .front {
  width: var(--rect-width);
  height: var(--rect-height);
  transform: translate(-50%, -50%) rotateY(0deg)
    translateZ(calc(var(--rect-depth) / 2));
}

.cuboid .rear {
  width: var(--rect-width);
  height: var(--rect-height);
  transform: translate(-50%, -50%) rotateY(-180deg)
    translateZ(calc(var(--rect-depth) / 2));
}

.cuboid .left {
  width: var(--rect-depth);
  height: var(--rect-height);
  transform: translate(-50%, -50%) rotateY(-90deg)
    translateZ(calc(var(--rect-width) / 2));
}

.cuboid .right {
  width: var(--rect-depth);
  height: var(--rect-height);
  transform: translate(-50%, -50%) rotateY(90deg)
    translateZ(calc(var(--rect-width) / 2));
}

.cuboid .top {
  width: var(--rect-width);
  height: var(--rect-depth);
  transform: translate(-50%, -50%) rotateX(90deg)
    translateZ(calc(var(--rect-height) / 2));
}

.cuboid .bottom {
  width: var(--rect-width);
  height: var(--rect-depth);
  transform: translate(-50%, -50%) rotateX(-90deg) rotateZ(180deg)
    translateZ(calc(var(--rect-height) / 2));
}

.cube {
  --rect-width: var(--cube-size);
  --rect-height: var(--cube-size);
  --rect-depth: var(--cube-size);
}

.model {
  position: relative;
  transform-style: preserve-3d;
  width: var(--model-width, 300px);
  height: var(--model-height, 300px);
  margin: auto;
  transform-origin: 50% 50%;
  transform: rotateX(var(--mc-rotate-y, 0deg)) rotateY(var(--mc-rotate-x, 0deg));
}

.model .cuboid {
  transform: none !important;
}

.row {
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  display: flex;
  justify-content: center;
}

.player {
  /* misc */
  --width: calc(var(--mc-height) / 2);
  --head-size: calc(var(--mc-height) / 4);

  --torso-width: calc(var(--mc-height) / 4);
  --torso-height: calc(var(--mc-height) / 2.6666);
  --torso-depth: calc(var(--mc-height) / 8);

  --leg-width: calc(var(--mc-height) / 8);
  --leg-depth: calc(var(--mc-height) / 8);
  --leg-height: calc(var(--mc-height) / 2.6666);

  --hand-width: calc(var(--mc-height) / 8);
  --hand-depth: calc(var(--mc-height) / 8);
  --hand-height: calc(var(--mc-height) / 2.6666);

  /*****/
  --model-height: var(--mc-height);
  --model-width: var(--width);
}

.player_slim {
  --hand-width: calc(var(--mc-height) / 8 / 4 * 3);
  --hand-depth: calc(var(--mc-height) / 8);
  --hand-height: calc(var(--mc-height) / 2.6666);
}

:is(
    .player__head,
    .player__torso,
    .player__left-hand,
    .player__left-leg,
    .player__right-hand,
    .player__right-leg
  )
  .face {
  --cell: calc(100% / 7);
  background-image: var(--mc-skin);
  background-size: 800%;
  background-color: tomato;
  border: none;
}

.player__head {
  --cube-size: var(--head-size);
}

.player__head .front {
  background-position-x: var(--cell);
  background-position-y: var(--cell);
}

.player__head .rear {
  background-position-y: calc(var(--cell) * 1);
  background-position-x: calc(var(--cell) * 3);
}

.player__head .left {
  background-position-y: calc(var(--cell) * 1);
  background-position-x: calc(var(--cell) * 0);
}

.player__head .right {
  background-position-y: calc(var(--cell) * 1);
  background-position-x: calc(var(--cell) * 2);
}

.player__head .top {
  background-position-y: 0;
  background-position-x: calc(var(--cell) * 1);
}

.player__head .bottom {
  background-position-y: 0;
  background-position-x: calc(var(--cell) * 2);
}

.player__torso {
  --rect-depth: var(--torso-depth);
  --rect-width: var(--torso-width);
  --rect-height: var(--torso-height);
}

.player__torso .face {
  --cell: calc(100% / 8);
  background-color: tomato;
}

.player__torso .front {
  background-position-x: calc(var(--cell) * 2.86);
  background-position-y: calc(var(--cell) * 3.07);
}

.player__torso .rear {
  background-position-x: calc(var(--cell) * 4);
  background-position-y: calc(var(--cell) * 3.08);
}

.player__torso .left {
  background-position-x: calc(var(--cell) * 2.13);
  background-position-y: calc(var(--cell) * 3.08);
  background-size: 1600%;
}

.player__torso .right {
  background-position-x: calc(var(--cell) * 4.8);
  background-position-y: calc(var(--cell) * 3.08);
  background-size: 1600%;
}

.player__torso .top {
  background-position-x: calc(var(--cell) * 2.86);
  background-position-y: calc(var(--cell) * 2.13);
}

.player__torso .bottom {
  background-position-x: calc(var(--cell) * 4);
  background-position-y: calc(var(--cell) * 2.13);
}

.player__left-hand,
.player__right-hand {
  --rect-depth: var(--hand-depth);
  --rect-width: var(--hand-width);
  --rect-height: var(--hand-height);
}

.player__left-hand .face,
.player__right-hand .face {
  background-position-y: calc(var(--cell) * 2.7);
}

.player__left-hand .front {
  background-position-x: calc(var(--torso-width) * -5.54);
  background-size: 1600%;
}

.player_slim .player__left-hand .front {
  background-size: 2150%;
}

.player__left-hand .rear {
  background-position-x: calc(var(--cell) * 6.067);
  background-size: 1600%;
}

.player_slim .player__left-hand .rear {
  background-size: 2150%;
}

.player__left-hand .left {
  background-position-x: calc(var(--cell) * 4.666);
  background-size: 1600%;
}

.player__left-hand .right {
  background-position-x: calc(var(--cell) * 5.6);
  background-size: 1600%;
}

.player__left-hand .top {
  background-position-x: calc(var(--cell) * 5.135);
  background-position-y: calc(var(--cell) * 1.7);
  background-size: 1600%;
}

.player__left-hand .bottom {
  background-position-x: calc(var(--cell) * 5.6);
  background-position-y: calc(var(--cell) * 1.866);
  background-size: 1600%;
  transform: translate(-50%, -50%) rotateX(-90deg)
    translateZ(calc(var(--rect-height) / 2));
}

/* TODO: Separate textures for the right hand */
.player__right-hand .front {
  background-position-x: calc(var(--cell) * 5.137);
  background-size: 1600%;
}

.player__right-hand .rear {
  background-position-x: calc(var(--cell) * 6.067);
  background-size: 1600%;
}

.player_slim .player__right-hand .rear {
  background-size: 2150%;
}

.player__right-hand .left {
  background-position-x: calc(var(--cell) * 4.666);
  background-size: 1600%;
}

.player__right-hand .right {
  background-position-x: calc(var(--cell) * 5.6);
  background-size: 1600%;
}

.player__right-hand .top {
  background-position-x: calc(var(--cell) * 5.135);
  background-position-y: calc(var(--cell) * 1.865);
  background-size: 1600%;
}

.player__right-hand .bottom {
  background-position-x: calc(var(--cell) * 5.6);
  background-position-y: calc(var(--cell) * 1.866);
  background-size: 1600%;
  transform: translate(-50%, -50%) rotateX(-90deg)
    translateZ(calc(var(--rect-height) / 2));
}

.player__left-leg,
.player__right-leg {
  --rect-depth: var(--leg-depth);
  --rect-width: var(--leg-width);
  --rect-height: var(--leg-height);
}

.player__left-leg .front {
  background-position-x: calc(var(--cell) * 0.47);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__left-leg .rear {
  background-position-x: calc(var(--cell) * 1.4);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__left-leg .left {
  background-position-x: calc(var(--cell) * 0);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__left-leg .right {
  background-position-x: calc(var(--cell) * 0.936);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__left-leg .top {
  background-position-x: calc(var(--cell) * 5.05);
  background-position-y: calc(var(--cell) * 1.87);
  background-size: 2150%;
}

.player__left-leg .bottom {
  background-position-x: calc(var(--cell) * 0.93);
  background-position-y: calc(var(--cell) * 1.866);
  background-size: 1600%;
  transform: translate(-50%, -50%) rotateX(-90deg) scaleX(-1)
    translateZ(calc(var(--rect-height) / 2));
}

/* TODO: Separate texture for the right leg */
.player__right-leg .front {
  background-position-x: calc(var(--cell) * 0.47);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__right-leg .rear {
  background-position-x: calc(var(--cell) * 1.4);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__right-leg .left {
  background-position-x: calc(var(--cell) * 0);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__right-leg .right {
  background-position-x: calc(var(--cell) * 0.936);
  background-position-y: calc(var(--cell) * 2.698);
  background-size: 1600%;
}

.player__right-leg .top {
  background-position-x: calc(var(--cell) * 3.266);
  background-position-y: calc(var(--cell) * 1.865);
  background-size: 1600%;
}

.player__right-leg .bottom {
  background-position-x: calc(var(--cell) * 0.93);
  background-position-y: calc(var(--cell) * 1.866);
  background-size: 1600%;
  transform: translate(-50%, -50%) rotateX(-90deg) scaleX(-1)
    translateZ(calc(var(--rect-height) / 2));
}
