What can a widget use?−
One HTML file with inline CSS and JS. Flexbox, tables, gradients, custom properties. No network, no external fonts, no images except data:.
How wide is a bubble?+
About 360–420 px. Design for 400 px and let the height follow the content; what is taller than the client's cap is clipped, nothing scrolls inside the bubble.
Can the widget talk to the bot?+
Not directly: a widget never sends a message for the user. It keeps its state in localStorage for this message, and TelegramWidget.openLink(url) opens a page after a confirmation dialog.
What happens if my script hangs?+
The sandbox has a CPU budget of about 300 ms per second. Over budget, timers are deferred; a tight loop is killed and the last render stays on screen.
Does dark mode work?+
Use @media (prefers-color-scheme: dark). It reflects the chat theme, not the OS setting, and switches live.