* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, system-ui, sans-serif; }
body { display: flex; flex-direction: column; background: #fff; }
#bar { padding: 10px 14px; background: #f3f3f3; font-size: 13px; color: #666; border-bottom: 1px solid #e2e2e2; }
#log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 16px; font-size: 15px; line-height: 1.35; word-break: break-word; }
.msg.me { align-self: flex-end; background: #2d6cff; color: #fff; }
.msg.them { align-self: flex-start; background: #ececec; color: #111; }
.msg.pending { opacity: 0.55; }
#composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e2e2e2; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
#input { flex: 1; padding: 11px 14px; border: 1px solid #ccc; border-radius: 20px; font-size: 16px; }
#composer button[type="submit"] { padding: 0 18px; border: 0; border-radius: 20px; background: #2d6cff; color: #fff; font-size: 15px; }
.read-receipt { align-self: flex-end; font-size: 11px; color: #999; margin: -2px 4px 2px 0; }
.typing-bubble { display: inline-flex; gap: 5px; align-items: center; padding: 12px 14px; }
.typing-bubble span { width: 7px; height: 7px; border-radius: 50%; background: #9a9a9a; animation: typing-bounce 1.2s infinite ease-in-out; }
.typing-bubble span:nth-child(2) { animation-delay: 0.18s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}
#attach { width: 38px; height: 38px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: #eef0f3; color: #5b6573; cursor: pointer; padding: 0; }
#attach svg { width: 21px; height: 21px; }
#attach:active { background: #e2e5ea; }
.login { position: fixed; inset: 0; background: #fff; display: flex; align-items: center; justify-content: center; z-index: 10; }
.login[hidden] { display: none; }
.login form { display: flex; flex-direction: column; gap: 12px; width: 260px; }
.login h1 { font-size: 20px; font-weight: 600; text-align: center; margin: 0 0 6px; }
.login input { padding: 12px 14px; border: 1px solid #ccc; border-radius: 10px; font-size: 16px; }
.login button { padding: 12px; border: 0; border-radius: 10px; background: #2d6cff; color: #fff; font-size: 16px; cursor: pointer; }
.login-error { color: #d33; font-size: 13px; min-height: 16px; text-align: center; }
.msg.file { padding: 6px; }
.msg.file img { display: block; max-width: 220px; max-height: 260px; border-radius: 12px; }
.file-card { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; min-width: 140px; }
.file-card .name { font-size: 14px; word-break: break-all; }
.file-card .meta { font-size: 11px; color: #888; }
.file-card a { font-size: 12px; color: #2d6cff; text-decoration: none; cursor: pointer; }
.msg.me .file-card a { color: #cfe0ff; }
