@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    --color-light: #232323;
    --color-dark: #1D1D1D;
}

body {
    background-color: var(--color-dark);
    color: white;
    margin: 0;
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: min-content auto;
    font-family: 'Roboto', sans-serif;
}

h2 {
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100% - 2rem);
    background-color: var(--color-light);
    text-align: center;
    padding: 1rem;
    margin: 0;
}

.ui {
    margin: 1rem;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    width: calc(100% - 4rem);
    display: grid;
    grid-template-columns: auto 4rem;
    background-color: var(--color-dark);
    opacity: 0.9;
    border: 1px solid dimgray;
    border-radius: 0.5rem;
    z-index: 4;
}

#chat-input {
    width: calc(100% - 2rem);
    font-size: 2rem;
    background: none;
    border: none;
    border-bottom: 1px solid dimgray;
    outline: none;
    color: white;
}

#chat-input[disabled] {
    color: dimgray;
    font-size: 1rem;
}

#chat-send  {
    aspect-ratio: 1;
    font-size: 3rem;
    background: none;
    padding: 0;
    margin: 0;
    border: none;
    cursor: pointer;
}

#chat-input,
#chat-send  {
    outline: none;
}

.chat {
    margin-top: 4rem;
    margin-bottom: 7rem;
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 5fr 1fr;
    gap: 2rem;
}

.chat .chat-message {
    --bg-color: var(--color-dark);
    --border-color: var(--color-light);

    grid-column: 1 / span 2;
    display: grid;
    width: fit-content;
    height: fit-content;
    grid-template-columns: auto min-content;
    padding: 1rem;
    border: 2px solid var(--border-color);
    background-color: var(--bg-color);
    border-radius: 0.5rem;
    overflow: hidden;
    scroll-margin-top: 4rem;
}

.chat .chat-message.self,
.chat .chat-message.servermessage {
    grid-column: 2 / span 2;
    justify-self: right;
}

.chat-message .sender {
    text-wrap: nowrap;
    grid-row: 1;
    grid-column: 1;
    font-size: .8rem;
    color: rgb(var(--primary));
}

.chat .chat-message.self .sender,
.chat .chat-message.servermessage .sender {
    grid-column: 2;
}

.chat-message .text {
    grid-row: 2;
    grid-column: 1 / span 2;
    font-size: 1.5rem;
}

/* THEMES */
.servermessage {
    --primary: 92, 92, 92;
}
.theme-0 {
    --primary: 218, 63, 177;
}
.theme-1 {
    --primary: 171, 64, 183;
}
.theme-2 {
    --primary: 84, 67, 194;
}
.theme-3 {
    --primary: 43, 103, 213;
}
.theme-4 {
    --primary: 48, 149, 242;
}
.theme-5 {
    --primary: 43, 206, 255;
}
.theme-6 {
    --primary: 82, 221, 246;
}
.theme-7 {
    --primary: 87, 214, 119;
}
.theme-8 {
    --primary: 94, 241, 46;
}
.theme-9 {
    --primary: 174, 234, 31;
}
.theme-a {
    --primary: 254, 247, 17;
}
.theme-b {
    --primary: 254, 205, 12;
}
.theme-c {
    --primary: 255, 153, 29;
}
.theme-d {
    --primary: 255, 101, 30;
}
.theme-e {
    --primary: 255, 20, 52;
}
.theme-f {
    --primary: 250, 48, 163;
}