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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: transparent;
}

.embed-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9f9f9;
}

.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.45;
}

.message.user .message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.message.assistant .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* Sources */
.sources {
    margin-top: 8px;
    font-size: 0.8em;
    color: #666;
}

.sources-list {
    margin: 4px 0 0 0;
    padding-left: 1.25em;
}

.sources-list li {
    margin-bottom: 2px;
    word-break: break-word;
}

.sources-list a {
    color: #667eea;
    text-decoration: none;
}

.sources-list a:hover {
    text-decoration: underline;
}

/* Error */
.message-bubble.error {
    background: #fee;
    color: #c33;
    border: 1px solid #f5c6c6;
}

/* Markdown content */
.message-bubble p {
    margin-bottom: 0.6em;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.4em 0;
    padding-left: 1.5em;
}

.message-bubble li {
    margin-bottom: 0.2em;
}

.message-bubble code {
    background: #f0f0f0;
    padding: 0.15em 0.35em;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.message-bubble pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.6em 0;
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

.message-bubble strong {
    font-weight: 600;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 0.6em 0 0.4em 0;
    font-weight: 600;
}

.message-bubble h1 { font-size: 1.2em; }
.message-bubble h2 { font-size: 1.1em; }
.message-bubble h3 { font-size: 1em; }

/* Input area */
.input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

.input-area input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.input-area input:focus {
    border-color: #667eea;
}

.input-area button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.input-area button:hover {
    background: #5568d3;
}

.input-area button:disabled {
    background: #ccc;
    cursor: not-allowed;
}