body {
 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
 background: #f0f0f0;
 padding: 20px;
}

.chat {
 max-width: 380px;
 margin: 0 auto;
}

.bubble {
 position: relative;
 padding: 12px 16px;
 margin: 10px 0;
 border-radius: 20px;
 max-width: 75%;
 line-height: 1.4;
 font-size: 15px;
 box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Received (left side) - Gray like iMessage */
.received {
 background: #e5e5ea;
 color: #000;
 align-self: flex-start;
 border-bottom-left-radius: 4px; /* flatten the tail side */
}

/* Sent (right side) - Blue like iMessage */
.sent {
 background: #007aff;
 color: white;
 align-self: flex-end;
 border-bottom-right-radius: 4px;
}

/* The tail */
.bubble::after {
 content: "";
 position: absolute;
 bottom: 0;
 width: 0;
 height: 0;
 border: 8px solid transparent;
}

/* Left tail (received) */
.received::after {
 left: -8px;
 border-right-color: #e5e5ea;
 border-bottom-color: #e5e5ea;
}

/* Right tail (sent) */
.sent::after {
 right: -8px;
 border-left-color: #007aff;
 border-bottom-color: #007aff;
}

.messages {
 display: flex;
 flex-direction: column;
}
