:root {
    --bg-color: #212121;
    --sidebar-bg: #070707;
    --chat-bg: #212121;
    --assistant-bubble: #595959;
    --user-bubble: #185bcf;
    --text-color: #ececf1;
    --border-color: #ffffff4d;
    --link: #7ab7ff;
    --link-hover: #5e83b3;
}

* {
    box-sizing: border-box;
}

html {
    width: 100vw;
    scrollbar-gutter: stable;
    background: var(--bg-color);
}

body {
    margin: 0;
    display: flex;
    height: 100vh;
    color: var(--text-color);
    background: var(--bg-color);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--link-hover);
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
}

.sidebar header {
    padding: 1rem 1rem 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.new-chat-btn {
    margin: 0.75rem 1rem;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: inherit;
    width: calc(100% - 2rem);
    cursor: pointer;
    transition: background 0.2s;
}
.new-chat-btn:hover {
    background: var(--assistant-bubble);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem 1rem;
}
.conversation-item {
    padding: 0.75rem 0.75rem;
    border-radius: 16px;
    margin: 0.25rem 0;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}
.conversation-item:hover {
    background: var(--assistant-bubble);
}

.startMessage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    transition: opacity 0.5s;
    position: absolute;
    top: -200px;
}

.startImage {
    width: 125px;
    margin-bottom: 25px;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    transform: perspective(400px) rotate3d(var(--r, 1, -1), 0, calc(var(--i, 1) * var(--a)));
    -webkit-mask: linear-gradient(135deg, #000c 40%, #000, #000c 60%) 100% 100%/250% 250%;
    transition: 0.4s;
    cursor: pointer;
}

.startImage:hover {
    --i: -1;
    --a: 8deg;
    -webkit-mask-position: 0 0;
}

.chat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    background: var(--chat-bg);
}

.messages-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: center;
    overflow-y: auto;
}

.messages {
    display: flex;
    width: 100%;
    height: fit-content;
    flex-direction: column;
    padding: 1.5rem 2rem;
    max-width: 750px;
}

.message {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    line-height: 1.45;
    word-break: break-word;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--border-color);
}
.message.assistant {
    background: var(--assistant-bubble);
    align-self: flex-start;
}
.message.user {
    background: var(--user-bubble);
    align-self: flex-end;
}
.message.system {
    background: var(--assistant-bubble);
    opacity: 0.75;
    align-self: center;
    font-style: italic;
}

.input-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(6px);
    width: 100%;
    max-width: 750px;
    margin-bottom: 45dvh;
    transition: all 1s;
}

@media (max-width: 768px) {
    .input-area {
        margin-bottom: 30dvh;
    }
    .chat.has-messages .input-area {
        margin-bottom: 2.5dvh !important;
    }

    .startMessage {
        font-size: 1.5rem;
    }
}
.input-area #input-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.input-area textarea {
    width: 100%;
    height: 83px;
    resize: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-color);
    padding: 0.75rem 1rem 2rem;
    font-size: 1rem;
    min-height: 100%;
    max-height: 250px;
    font-family: inherit;
    transition: all 0.2s;
}
.input-area textarea:focus {
    outline: none;
    border-color: #ffffff89;
}

.input-area .sendBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    border-radius: 50%;
    background-color: #fff;
    width: 30px;
    height: 30px;
    padding: 7.5px;
    right: 10px;
    bottom: 10px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.input-area .sendBtn:hover {
    background-color: #dadada;
}

.send-btn {
    background: var(--user-bubble);
    border: none;
    padding: 0 1.5rem;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}
.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.newChatBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    border-radius: 50%;
    background: none;
    width: 35px;
    height: 35px;
    padding: 7.5px;
    right: 10px;
    top: 10px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.newChatBtn:hover {
    background-color: #dadada;
}

.newChatBtn svg {
    width: 100%;
    height: 100%;
    fill: var(--text-color);
}

.newChatBtn:hover {
    background-color: var(--assistant-bubble);
}

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-thumb {
    background: var(--assistant-bubble);
    border-radius: 3px;
}

.chat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; 
}

.chat:not(.has-messages) {
    justify-content: center;
}

.chat:not(.has-messages) .messages {
    display: none;
}
.chat.has-messages .startMessage {
    opacity: 0;
    user-select: none;
    pointer-events: none;
}

.chat.has-messages .input-area {
    padding-top: 0;
    margin-bottom: 5dvh;
}

.message.assistant .message-content.loading {
    display: flex;
    justify-content: center;
    align-items: center;
}

.message-content > * {
    margin: 0;
}

.message-content > p:not(:last-child) {
    margin-bottom: 1rem;
}

.message-content > ul:not(:last-child) {
    margin: 1rem 0;
}

p:has(+ ul) {
  margin-bottom: 0 !important;
}

.loader {
    width: 20px;
    aspect-ratio: 2;
    --_g: no-repeat radial-gradient(circle closest-side, var(--text-color) 90%, #0000);
    background: var(--_g) 0% 50%, var(--_g) 50% 50%, var(--_g) 100% 50%;
    background-size: calc(100% / 3) 50%;
    animation: l3 1s infinite linear;
}
@keyframes l3 {
    20% {
        background-position: 0% 0%, 50% 50%, 100% 50%;
    }
    40% {
        background-position: 0% 100%, 50% 0%, 100% 50%;
    }
    60% {
        background-position: 0% 50%, 50% 100%, 100% 0%;
    }
    80% {
        background-position: 0% 50%, 50% 50%, 100% 100%;
    }
}

.sendBtnLoader {
    --_g: no-repeat radial-gradient(circle closest-side, #000 90%, #0000);
}