:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0c0d10;
    color: #f5f7fa;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(91, 71, 255, 0.13), transparent 30%),
        #0c0d10;
}

button,
textarea {
    font: inherit;
}

.app {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 18px;
    border-right: 1px solid #24262d;
    background: rgba(17, 18, 22, 0.92);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.brand-logo,
.welcome-logo,
.avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    font-weight: 800;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #745cff, #9a70ff);
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    margin-top: 2px;
    color: #8f94a3;
    font-size: 13px;
}

.new-chat {
    width: 100%;
    padding: 12px 14px;
    cursor: pointer;
    color: #fff;
    border: 1px solid #343741;
    border-radius: 10px;
    background: #1c1e24;
    transition: 0.2s ease;
}

.new-chat:hover {
    border-color: #6652dc;
    background: #23252d;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9297a6;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ed598;
    box-shadow: 0 0 10px rgba(62, 213, 152, 0.8);
}

.chat {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid #24262d;
    background: rgba(12, 13, 16, 0.8);
    backdrop-filter: blur(12px);
}

.chat-header h1 {
    margin: 0;
    font-size: 18px;
}

.chat-header p {
    margin: 5px 0 0;
    color: #8f94a3;
    font-size: 13px;
}

.model-badge {
    padding: 7px 11px;
    color: #c7bfff;
    border: 1px solid rgba(116, 92, 255, 0.4);
    border-radius: 999px;
    background: rgba(116, 92, 255, 0.12);
    font-size: 12px;
}

.messages {
    overflow-y: auto;
    padding: 40px max(28px, calc((100% - 900px) / 2));
}

.welcome {
    max-width: 580px;
    margin: 16vh auto 0;
    text-align: center;
}

.welcome-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #745cff, #9a70ff);
    box-shadow: 0 18px 50px rgba(116, 92, 255, 0.24);
}

.welcome h2 {
    margin: 0 0 10px;
    font-size: 25px;
}

.welcome p {
    margin: 0;
    color: #969baa;
}

.message {
    display: flex;
    gap: 13px;
    max-width: 860px;
    margin: 0 auto 28px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 13px;
}

.message.user .avatar {
    background: #30333c;
}

.message.assistant .avatar {
    background: linear-gradient(135deg, #745cff, #9a70ff);
}

.message-content {
    min-width: 0;
    padding-top: 5px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-role {
    margin-bottom: 5px;
    color: #8f94a3;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.message.error .message-content {
    color: #ff9191;
}

.typing {
    color: #9da2b1;
}

.composer {
    padding: 16px max(28px, calc((100% - 900px) / 2)) 22px;
    border-top: 1px solid #24262d;
    background: linear-gradient(to top, #0c0d10 70%, rgba(12, 13, 16, 0.85));
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 10px;
    border: 1px solid #353842;
    border-radius: 16px;
    background: #17191e;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.2);
}

textarea {
    width: 100%;
    max-height: 180px;
    resize: none;
    outline: none;
    color: #f4f5f7;
    border: 0;
    background: transparent;
    line-height: 1.5;
}

textarea::placeholder {
    color: #737887;
}

#sendButton {
    padding: 10px 16px;
    cursor: pointer;
    color: #fff;
    border: 0;
    border-radius: 10px;
    background: #745cff;
}

#sendButton:hover {
    background: #836dff;
}

#sendButton:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.composer-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 4px;
    color: #686d7b;
    font-size: 11px;
}

@media (max-width: 760px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .chat-header {
        padding: 16px 18px;
    }

    .messages,
    .composer {
        padding-left: 16px;
        padding-right: 16px;
    }
}
