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; anything over ~900 px scrolls inside the bubble.
Can the widget talk to the bot?+
Yes: TelegramWidget.sendMessage(text) sends a message to the chat as the user, and links open through 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.