:root {
    --ink: #111111;
    --bg: #ffffff;
    --card: #ffffff;
    --line: #eaeaea;
    --text: #111827;
    --muted: #6b7280;
    --radius: 16px;
    --radius-lg: 20px;
    --ease: cubic-bezier(.22,.61,.36,1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.page { min-height: 100dvh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 420px; margin: 0 auto; padding: 0 16px; }
header { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { height: 56px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 600; color: var(--text); }
.cta { padding: 10px 14px; background: var(--ink); color: #fff; border: 0; border-radius: 999px; font-weight: 500; cursor: pointer; transition: transform .25s var(--ease), opacity .25s var(--ease); }
.cta:active { transform: scale(.98); }
main { flex: 1; display: grid; place-items: start center; }
.card { width: 100%; border-radius: var(--radius-lg); padding: 16px; height: 50vh; display: flex; flex-direction: column; }
.chat { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; padding-right: 4px; }
.chat::-webkit-scrollbar { width: 6px; }
.chat::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 999px; }
.row { display: flex; align-items: stretch; gap: 10px; opacity: 0; transform: translateY(6px); }
.row.show { animation: fadeIn .35s var(--ease) forwards; }
.row.show .avatar { animation: avatarIn .28s var(--ease) both; }
.row.show .bubble { animation: bubbleIn .3s var(--ease) .04s both; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.06); border: 2px solid rgba(0,0,0,.2); flex: 0 0 36px; align-self: flex-end; }
.row.user { justify-content: flex-end; }
.row.user .bubble { background: #f8fafc; border: 1px solid #e5e7eb; }
.row.user .avatar { background: #e5e7eb; border-color: #a3a3a3; order: 2; }
.chat .row .avatar { visibility: hidden; }
.chat .row.last-ai .avatar { visibility: visible; }
.chat .row.user .avatar { visibility: visible; }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 18px 18px 18px 10px; padding: 10px 12px; font-size: 15px; line-height: 1.4; color: var(--text); max-width: 85%; align-self: flex-start; }
.row.user .bubble { border-radius: 18px 18px 10px 18px; }
.muted { color: var(--muted); }
.typing { display: inline-flex; gap: 6px; align-items: center; padding: 8px 10px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #d1d5db; animation: pulse 1s infinite ease-in-out; }
.dot:nth-child(2){ animation-delay: .15s; } .dot:nth-child(3){ animation-delay: .3s; }
.reply-group { display: grid; gap: 10px; align-items: start; justify-content: start; animation: popIn .25s var(--ease) both; }
.btn { padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500; cursor: pointer; transition: transform .2s var(--ease), opacity .2s var(--ease), background .2s var(--ease); }
.btn.reply { width: auto; max-width: 100%; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: #fff; border-color: transparent; }
.btn.sending, .btn:disabled { opacity: .6; pointer-events: none; transform: scale(.98); }
.upload-inline { margin-top: 10px; border: 1px dashed var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.file { display: block; width: 100%; }
.qr { width: 120px; height: 120px; background: #f4f4f5; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; color: #9ca3af; font-size: 12px; }
.row .stack { display: grid; gap: 8px; }
.small-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.small { padding: 10px 12px; font-size: 14px; }
footer { height: 16px; }
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }
@keyframes avatarIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.bubble-swap { animation: bubbleSwap .28s var(--ease) both; }
@keyframes bubbleSwap { from { opacity: .2; transform: translateY(2px) scale(.995); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes popIn { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulse { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-1px); } }
@media (min-width: 768px) { main { place-items: center; } }


