* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    height: 100vh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

header {
    padding: 16px 24px;
    background: #1a1a2e;
    color: #fff;
}

header h1 { font-size: 1.3rem; font-weight: 600; }
.subtitle { font-size: 0.85rem; opacity: 0.7; margin-top: 4px; }

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message { display: flex; }
.message.user { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }

.bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.user .bubble {
    background: #1a1a2e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.assistant .bubble {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.bubble ul { margin: 8px 0 0 20px; }
.bubble li { margin: 4px 0; }
.bubble strong { font-weight: 600; }
.bubble code { background: #e0e0e0; padding: 2px 6px; border-radius: 3px; font-size: 0.85em; }
.bubble pre { background: #e8e8e8; padding: 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; }
.bubble pre code { background: none; padding: 0; }
.bubble h1, .bubble h2, .bubble h3 { margin: 12px 0 6px; }
.bubble p { margin: 6px 0; }
.bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 0.85em; }
.bubble th, .bubble td { border: 1px solid #ccc; padding: 6px 10px; text-align: left; }
.bubble th { background: #e8e8e8; }

.input-area {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    outline: none;
}

#user-input:focus { border-color: #1a1a2e; }

#send-btn {
    padding: 12px 24px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

#send-btn:hover { background: #16213e; }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.loading .bubble::after {
    content: '...';
    animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}
