:root {
    --primary: #2A61DC;
    --primary-dark: #1e46a3;
    --bg-light: #f5f7fb;
    --bubble-user: #d2f8cd;
    --bubble-bot: #ececf3;
    --radius-lg: 22px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Heebo', sans-serif;
    background: var(--bg-light);
    color: #333;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
/* ---------- Header ---------- */
header.header {
    background: var(--primary);
    color: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.logo {
    height: 48px;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
}

.chain-select, .topk-select {
    min-width: 120px;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
}

.topk-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.topk-container label {
    font-weight: 500;
}

.topk-select {
    min-width: 80px;
}

.chain-header {
    font-weight: 600;
    letter-spacing: 1px;
}

.mute-toggle {
    font-size: 1.25rem;
    cursor: pointer;
    user-select: none;
}
/* ---------- Main Container ---------- */
main.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 1rem auto;
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 6px 25px rgba(0,0,0,0.08);
}
/* Chat Window */
.chat-window {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

    .chat-window::-webkit-scrollbar {
        width: 8px;
    }

    .chat-window::-webkit-scrollbar-thumb {
        background: var(--primary);
        border-radius: 4px;
    }
/* Message line */
.message-line {
    display: flex;
    margin-block: 0.75rem;
}

    .message-line.user {
        justify-content: flex-end;
    }

    .message-line.bot {
        justify-content: flex-start;
    }

.avatar {
    font-size: 1.75rem;
    margin-inline-end: 0.5rem;
    align-self: flex-end;
}

.bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    font-size: 0.95rem;
    word-break: break-word;
    background: var(--bubble-bot);
}

    .bubble.user {
        background: var(--bubble-user);
        border-bottom-right-radius: 0;
    }

    .bubble.bot {
        background: var(--bubble-bot);
        border-bottom-left-radius: 0;
    }
/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
}

    .typing-indicator .dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #999;
        animation: blink 1.4s infinite ease-in-out alternate;
    }

        .typing-indicator .dot:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator .dot:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes blink {
    from {
        opacity: 0.2;
    }

    to {
        opacity: 1;
    }
}
/* Input Area */
.input-area {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid #eee;
    background: #fafafa;
}

textarea {
    flex: 1;
    resize: none;
    min-height: 38px;
    max-height: 180px;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 12px;
    outline: none;
    transition: border 0.3s;
    font-family: inherit;
}

    textarea:focus {
        border-color: var(--primary);
    }

#sendBtn {
    flex-shrink: 0;
    padding: 0 22px;
    font-size: 1rem;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.25s;
}

    #sendBtn:hover {
        background: var(--primary-dark);
    }
/* Responsive tweaks */
@media (max-width: 600px) {
    header .header {
        justify-content: space-between;
    }

    header h1 {
        flex: 1 1 100%;
        text-align: center;
        font-size: 1.1rem;
        order: 3;
    }

    .logo {
        order: 1;
    }

    .chain-select, .chain-header {
        order: 2;
    }
}
