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

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #1e1f2c;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-container {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    background: #0f0f13;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

.chat-header {
    background: #2a2b38;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3e3f4e;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 12px;
}

.title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

h1 {
    font-size: 1.4rem;
    background: linear-gradient(135deg, #b3baff, #6c8eff);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.3px;
}

.badge {
    background: #2d2f3e;
    padding: 4px 10px;
    border-radius: 40px;
    font-size: 0.7rem;
    color: #b0b3d6;
    font-family: monospace;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.model-select {
    background: #3b3f5c;
    border: 1px solid #5a5f7e;
    border-radius: 30px;
    padding: 6px 12px;
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.model-select:hover {
    background: #535982;
}

.new-chat-btn {
    background: #3b3f5c;
    border: none;
    color: white;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.new-chat-btn:hover {
    background: #535982;
    transform: scale(0.97);
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 0;
}

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

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

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

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2c2e3f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    flex-shrink: 0;
    color: #eef2ff;
}

.user .avatar {
    background: #6c8eff;
}

.assistant .avatar {
    background: #3a3c54;
}

.message-content {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.bubble {
    background: #23242f;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.95rem;
    color: #eef2ff;
    word-break: break-word;
    overflow-wrap: break-word;
}

.user .bubble {
    background: #6c8eff;
    color: white;
    border-bottom-right-radius: 4px;
}

.assistant .bubble {
    background: #2a2c3c;
    border-bottom-left-radius: 4px;
}

.bubble p {
    margin: 0 0 0.5em 0;
}
.bubble p:last-child {
    margin-bottom: 0;
}
.bubble code {
    background: #1a1b2a;
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85em;
}
.bubble pre {
    background: #1a1b2a;
    padding: 12px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 0.5em 0;
}
.bubble pre code {
    background: transparent;
    padding: 0;
}
.bubble ul, .bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}
.bubble blockquote {
    border-left: 3px solid #6c8eff;
    margin: 0.5em 0;
    padding-left: 1em;
    color: #b9c3ff;
}
.bubble a {
    color: #8d9eff;
    text-decoration: none;
}
.bubble a:hover {
    text-decoration: underline;
}

.timestamp {
    font-size: 0.65rem;
    color: #6e7092;
    margin-top: 4px;
    margin-left: 8px;
    margin-right: 8px;
}

.input-area {
    background: #1a1b26;
    padding: 12px 20px 16px;
    border-top: 1px solid #2e3040;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
}

textarea {
    flex: 1;
    background: #282a3a;
    border: 1px solid #3f4156;
    border-radius: 28px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #f0f3ff;
    resize: none;
    max-height: 120px;
    transition: 0.1s;
}

textarea:focus {
    outline: none;
    border-color: #6c8eff;
    background: #1e1f30;
}

button {
    background: #6c8eff;
    border: none;
    color: white;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.9rem;
    height: 46px;
    transition: background 0.2s;
}

button:hover {
    background: #5570e6;
}

button:disabled {
    background: #4a4e6e;
    cursor: not-allowed;
    opacity: 0.6;
}

.loading-indicator {
    padding: 10px 16px;
    background: #22232e;
    border-radius: 30px;
    width: fit-content;
    color: #b9c3ff;
    margin-top: 8px;
    font-size: 0.85rem;
}

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

.info-footer {
    text-align: center;
    font-size: 0.7rem;
    color: #56587a;
    padding: 6px 0 8px;
    background: #0f0f13;
    border-top: 1px solid #22232e;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .message {
        max-width: 92%;
    }
    .bubble {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    .chat-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }
    .header-actions {
        justify-content: space-between;
    }
    .messages-area {
        padding: 12px;
    }
    .input-area {
        padding: 10px 16px 14px;
    }
    .avatar {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    button {
        padding: 8px 16px;
        height: 42px;
    }
}
