* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  background: #151617;
  color: #f0f0ec;
  font-family: Arial, Helvetica, sans-serif;
}

.game-shell {
  position: relative;
  width: min(960px, calc(100vw - 24px));
}

.character-switch {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid #2d3338;
  border-radius: 8px;
  background: rgb(21 22 23 / 76%);
}

.character-button {
  min-width: 66px;
  height: 34px;
  border: 1px solid #495158;
  border-radius: 6px;
  background: #202225;
  color: #f0f0ec;
  font: 700 13px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.character-button.is-active {
  background: #70c98b;
  border-color: #97e2aa;
  color: #101413;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #8ec7db;
  border: 2px solid #2b2f33;
  image-rendering: pixelated;
}

.hud {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
  color: #cfd2d1;
  font-size: 13px;
}

.hud span {
  border: 1px solid #3f4448;
  border-radius: 6px;
  padding: 6px 9px;
  background: #202225;
}

.touch-controls {
  display: none;
}

.touch-button {
  width: 64px;
  height: 64px;
  border: 2px solid #2d3338;
  border-radius: 8px;
  background: #f0f0ec;
  color: #151617;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  touch-action: none;
  user-select: none;
}

.touch-button:active,
.touch-button.is-pressed {
  background: #70c98b;
  transform: translateY(1px);
}

@media (hover: none), (pointer: coarse), (max-width: 760px) {
  body {
    align-content: center;
    padding: 10px;
  }

  .game-shell {
    width: 100%;
  }

  .hud {
    display: none;
  }

  .touch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-top: 12px;
  }

  .touch-move {
    display: flex;
    gap: 12px;
  }

  .jump-button {
    width: 76px;
    height: 76px;
  }

  .character-switch {
    top: 8px;
    right: 8px;
    gap: 4px;
    padding: 4px;
  }

  .character-button {
    min-width: 58px;
    height: 31px;
    font-size: 12px;
  }
}
