* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;

  background: #111;
  color: white;

  font-family: Arial, Helvetica, sans-serif;

  touch-action: manipulation;
  overscroll-behavior: none;
  overflow: hidden;
}

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

main {
  width: 100%;
  height: 100vh;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  /* ボタンを少し上へ */
  transform: translateY(-20px);
}

/* ゲーム画面 */

canvas {
  background: #000;
  border: 3px solid #555;

  image-rendering: pixelated;

  /* スマホ対応 */
  width: min(88vw, 288px);

  /* 縦長比率維持 */
  height: calc(min(88vw, 288px) * 2);
}

/* 操作ボタン */

.controls {
  margin-top: 10px;

  width: min(88vw, 288px);

  display: grid;
  grid-template-columns: repeat(4, 1fr);

  gap: 6px;
}

button {
  border: none;
  background: #333;
  color: white;

  padding: 12px 0;

  border-radius: 10px;

  font-size: 16px;
}

button:active {
  transform: scale(0.95);
  background: #555;
}

/* 小さいスマホ用 */

@media (max-height: 700px) {
  main {
    transform: translateY(-35px);
  }

  canvas {
    width: min(96vw, 340px);
    height: calc(min(80vw, 260px) * 2);
  }

  .controls {
    width: min(96vw, 340px);
  }

  button {
    padding: 10px 0;
    font-size: 14px;
  }
}