* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #111;
  font-family: Arial, sans-serif;

  touch-action: none;
  user-select: none;

  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game {
  width: 100%;
  height: 100%;

  display: flex;
  justify-content: center;
  align-items: center;
}


/* ==================================================
   ゲーム画面
   横長 16:9
================================================== */

#game-area {
  position: relative;

  width: min(
    100vw,
    calc(100vh * 16 / 9)
  );

  height: min(
    100vh,
    calc(100vw * 9 / 16)
  );

  overflow: hidden;

  background:
    linear-gradient(
      to bottom,
      #bde8ff 0%,
      #dff4ff 55%,
      #b8df8a 56%,
      #79b95a 100%
    );
}


/* ==================================================
   型レイヤー
================================================== */

#target-layer {
  position: absolute;
  inset: 0;

  z-index: 10;

  pointer-events: none;
}


/* ==================================================
   ピースレイヤー
================================================== */

#piece-layer {
  position: absolute;
  inset: 0;

  z-index: 20;
}


/* ==================================================
   正解の型
================================================== */

.target {
  position: absolute;

  display: block;

  height: auto;

  pointer-events: none;

  transform:
    translate(-50%, -50%);

  transform-origin:
    center center;

  opacity: 0.78;

  filter:
    drop-shadow(
      0 0 4px
      rgba(255, 255, 255, 0.3)
    );

  transition:
    transform 0.22s ease,
    filter 0.22s ease,
    opacity 0.22s ease;
}


/* ==================================================
   型ぽわん
================================================== */

.target.hint {
  transform:
    translate(-50%, -50%)
    scale(1.06);

  opacity: 1;

  filter:
    brightness(1.35)
    drop-shadow(
      0 0 7px
      rgba(255, 255, 255, 1)
    )
    drop-shadow(
      0 0 18px
      rgba(255, 255, 255, 0.95)
    )
    drop-shadow(
      0 0 32px
      rgba(255, 255, 255, 0.65)
    );
}


/* ==================================================
   動かす動物
================================================== */

.piece {
  position: absolute;

  display: block;

  height: auto;

  cursor: grab;

  touch-action: none;

  transform:
    translate(-50%, -50%);

  transform-origin:
    center center;

  filter:
    drop-shadow(
      0 6px 6px
      rgba(0, 0, 0, 0.28)
    );

  transition:
    filter 0.15s ease;
}


/* ==================================================
   掴んでいる最中
================================================== */

.piece:active {
  cursor: grabbing;

  filter:
    drop-shadow(
      0 8px 8px
      rgba(0, 0, 0, 0.35)
    );
}


/* ==================================================
   正解して吸着
================================================== */

.piece.locked {
  pointer-events: none;

  filter:
    drop-shadow(
      0 0 7px
      rgba(255, 255, 255, 1)
    )
    drop-shadow(
      0 0 17px
      rgba(255, 255, 255, 0.75)
    );

  /*
    シュポッ成功時
    ポンッと弾む
  */

  animation:
    success-pop 0.55s ease-out;
}


/* ==================================================
   成功アニメーション

   100%
   ↓
   118%
   ↓
   94%
   ↓
   104%
   ↓
   100%

   子供向けに
   少しだけ大げさにポンッ
================================================== */

@keyframes success-pop {

  0% {
    transform:
      translate(-50%, -50%)
      scale(1);
  }

  35% {
    transform:
      translate(-50%, -50%)
      scale(1.18);
  }

  58% {
    transform:
      translate(-50%, -50%)
      scale(0.94);
  }

  78% {
    transform:
      translate(-50%, -50%)
      scale(1.04);
  }

  100% {
    transform:
      translate(-50%, -50%)
      scale(1);
  }

}


/* ==================================================
   忖度案内 👆
================================================== */

#guide-hand {
  position: absolute;

  left: 0;
  top: 0;

  z-index: 100;

  display: none;

  font-size: 52px;
  line-height: 1;

  pointer-events: none;

  transform:
    translate(-50%, -50%);

  filter:
    drop-shadow(
      0 4px 5px
      rgba(0, 0, 0, 0.4)
    );
}


/* ==================================================
   忖度案内 表示
================================================== */

#guide-hand.show {
  display: block;
}