Calculate initial frame size dynamically.