#tooltip { position: absolute; width:auto; min-width:50px; max-width:250px; padding:10px; background-color:#eee; border:1px solid #aaa;
Try using one of this:
width: max-content; width: min-content; width: available; width: fit-content;
They are not 100% compatible, but prefixes fix that problem more or less.
Source: https://developer.mozilla.org/docs/Web/CSS/width