.touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 240px;
  z-index: 20;
  pointer-events: none;
}

.touch-controls .joystick-area {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 160px;
  height: 160px;
  pointer-events: all;
  touch-action: none;
}

.joystick-base {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(0, 200, 255, 0.12);
  border: 3px solid rgba(0, 200, 255, 0.35);
  position: relative;
  pointer-events: all;
  touch-action: none;
  box-shadow: 0 0 15px rgba(0, 200, 255, 0.15);
}

.joystick-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 200, 255, 0.35);
  border: 2px solid rgba(0, 200, 255, 0.6);
  position: absolute;
  top: 42px;
  left: 42px;
  transition: none;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0, 200, 255, 0.3);
}

/* 2x2 cluster. A single row of four buttons needed ~290px, which overlapped
   the joystick on 360px-wide phones. The container is inert so the gaps
   between buttons stay dead zones. */
.touch-controls .action-buttons {
  position: absolute;
  right: 16px;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 12px;
  align-items: center;
  justify-items: center;
  pointer-events: none;
}

.action-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 200, 255, 0.12);
  border: 3px solid rgba(0, 200, 255, 0.35);
  color: rgba(0, 200, 255, 0.9);
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.1s, border-color 0.1s, transform 0.1s, box-shadow 0.1s;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: all;
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.15);
}

.action-btn:active,
.action-btn.is-pressed {
  background: rgba(0, 200, 255, 0.35);
  border-color: rgba(0, 200, 255, 0.7);
  transform: scale(0.92);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.4);
}

.attack-btn {
  background: rgba(255, 90, 255, 0.12);
  border-color: rgba(255, 90, 255, 0.4);
  color: rgba(255, 140, 255, 0.95);
  box-shadow: 0 0 12px rgba(255, 90, 255, 0.2);
}

.attack-btn:active,
.attack-btn.is-pressed {
  background: rgba(255, 90, 255, 0.38);
  border-color: rgba(255, 90, 255, 0.75);
  box-shadow: 0 0 22px rgba(255, 90, 255, 0.5);
}

.action-btn-small {
  width: 52px;
  height: 52px;
  font-size: 14px;
  border-width: 2px;
  opacity: 0.85;
}

.action-btn-small:active,
.action-btn-small.is-pressed {
  opacity: 1;
}

@media (max-width: 480px) {
  .touch-controls {
    height: 210px;
  }

  .touch-controls .joystick-area {
    left: 12px;
    bottom: 12px;
    width: 138px;
    height: 138px;
  }

  .joystick-base {
    width: 118px;
    height: 118px;
    background: rgba(0, 200, 255, 0.15);
    border-color: rgba(0, 200, 255, 0.4);
  }

  .joystick-thumb {
    width: 48px;
    height: 48px;
    top: 35px;
    left: 35px;
    background: rgba(0, 200, 255, 0.4);
    border-color: rgba(0, 200, 255, 0.65);
  }

  .action-btn {
    width: 60px;
    height: 60px;
    font-size: 16px;
    border-width: 2px;
  }

  .action-btn-small {
    width: 46px;
    height: 46px;
    font-size: 12px;
  }

  .touch-controls .action-buttons {
    right: 10px;
    bottom: 18px;
    gap: 10px;
  }
}

@media (max-height: 500px) {
  .touch-controls {
    height: 150px;
  }

  .touch-controls .joystick-area {
    bottom: 6px;
    width: 118px;
    height: 118px;
  }

  .joystick-base {
    width: 104px;
    height: 104px;
  }

  .joystick-thumb {
    width: 42px;
    height: 42px;
    top: 31px;
    left: 31px;
  }

  .touch-controls .action-buttons {
    bottom: 8px;
    gap: 8px;
  }

  .action-btn {
    width: 54px;
    height: 54px;
    font-size: 15px;
  }

  .action-btn-small {
    width: 40px;
    height: 40px;
    font-size: 11px;
  }
}
