The biggest rectangle of content that fits inside a CSS border-radius without clipping into the corners — including irregular elliptical ones. Read the safe padding off, or grab the JS for your build.
Drop cornerfit.js next to your page and call cornerfit({width, height, borderRadius}). It returns frame (the safe rectangle), inset (use it as padding), sides (per-side lengths), and a contains(x,y) test. Works as a plain <script> (global cornerfit), via import from cornerfit.mjs, or through a bundler.
corner order TL · TR · BR · BL | horizontal % resolves to width, vertical % to height | oversized radii clamp exactly like the browser does | the safe frame is provably inside for any reach angle; "max area" is a numerical local maximum.