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

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-2: #252525;
    --border: #333;
    --text: #e0e0e0;
    --text-muted: #888;
    --primary: #f59e0b;
    --primary-dark: #d97706;
    --bot-bg: #1e1e2e;
    --user-bg: #2d4a3e;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    font-size: 32px;
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* Chat */
.chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: var(--surface-2);
}

.message.user .message-avatar {
    background: var(--user-bg);
}

.message-content {
    background: var(--bot-bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.5;
    font-size: 15px;
}

.message.user .message-content {
    background: var(--user-bg);
}

.message-content p {
    margin-bottom: 8px;
}

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

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    color: var(--text-muted);
}

.message-content a {
    color: var(--primary);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

/* Status indicator */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

.status-dot.processing {
    background: var(--primary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Preview */
.preview-container {
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.preview-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.preview-frame {
    width: 100%;
    height: 500px;
    border: none;
    background: #fff;
}

/* Input */
.input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#userInput {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
}

#userInput:focus {
    border-color: var(--primary);
}

.send-btn {
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Published link */
.published-link {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 16px;
    background: var(--primary);
    color: #000;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.published-link:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

/* Mobile */
@media (max-width: 600px) {
    .app {
        max-width: 100%;
    }

    .message {
        max-width: 92%;
    }

    .preview-frame {
        height: 400px;
    }

    .preview-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}
