Design a real-time chat system that supports 1-on-1 and group messaging, presence indicators, typing notifications, read receipts, and offline delivery for a product that must scale to 100 million daily active users with <200 ms p95 send-to-deliver latency, 99.99 % availability, and end-to-end security. Your design should cover: (1) Transport layer – choose between HTTP polling, long-polling, SSE, or WebSockets and justify how you handle millions of concurrent persistent connections; (2) Message flow – explain how a message sent by User A on Server 1 reaches User B connected to Server 2 without loss or reordering, including server-assigned sequence numbers, at-least-once acknowledgments, deduplication, and durable storage; (3) Presence & read receipts – describe how you publish “online/offline/typing” updates and sync read cursor across multiple devices of the same user; (4) Scaling patterns – show how you shard conversations, fan-out to large groups, cache hot data, and add/remove chat servers without coordination; (5) Reliability – detail failure handling for crashed servers, network partitions, and client reconnections; (6) Security & privacy – discuss end-to-end encryption trade-offs versus server-side search/spam filtering. You have 45 min: start with requirements, high-level architecture, deep-dive into one component of your choice, and close with capacity planning.