* {
  box-sizing: border-box;
  touch-action: none;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #333;
  overflow: hidden;
}

#joysticks {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 800px;
  position: relative;
}

.joystick-container {
  position: relative;
  width: 200px;
  height: 200px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid #fff;
  border-radius: 50%;
}

.joystick {
  position: absolute;
  width: 80px;
  height: 80px;
  background-color: #fff;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #555;
  border: 2px solid #fff;
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.button:active {
  background-color: #333;
}

.joystick-button {
  position: absolute;
}

.left-north {
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
}
.left-west {
  top: 50%;
  left: -20px;
  transform: translateY(-50%);
}
.left-east {
  top: 50%;
  right: -20px;
  transform: translateY(-50%);
}
.left-south {
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
}
.left-special {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.right-north {
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
}
.right-west {
  top: 50%;
  left: -20px;
  transform: translateY(-50%);
}
.right-east {
  top: 50%;
  right: -20px;
  transform: translateY(-50%);
}
.right-south {
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
}
.right-special {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#top-buttons {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

#top-special-buttons {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
}

.guide {
  transform: translateY(-30%);
}

.left-special,
.right-special {
  position: static;
  transform: none;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.left-corner {
  top: 0;
  left: 0;
}

.right-corner {
  top: 0;
  right: 0;
}

.corner-button {
  position: fixed;
}

.left-corner {
  top: 10px;
  left: 10px;
}

.right-corner {
  top: 10px;
  right: 10px;
}

.trigger-group {
  align-items: flex-end;
}

.trigger-slider {
  width: 40px;
  height: 100px;
  background: #444;
  border: 2px solid #fff;
  border-radius: 10px;
  position: relative;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
}

.trigger-thumb {
  width: 100%;
  height: 20px;
  background-color: #ccc;
  border-top: 2px solid #fff;
  cursor: pointer;
  position: absolute;
  bottom: 0;
  transition: background 0.1s;
}

.divider {
  width: 80%;
  size: 1px;
  margin: 20px 0 20px 0;
}

#orientation-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #333;
  color: #fff;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  font-size: 18px;
  z-index: 1000;
}

html {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

@media screen and (orientation: portrait) {
  #joysticks {
    display: none;
  }
  #orientation-overlay {
    display: flex;
  }
}
