

* {
    --bg: #222;
    --bg-l: #2a2a2a;
    --bg-ll: #333;
    --bg-lll: #444;

    --prim: #b42a2a;

    --hint-green: #538d4e;
    --hint-yellow: #b59f3b;
    --hint-red: #b42a2a;

    --sabotage-clickable: #b64343;

    --txt: #fff;
    --txt-d: #ccc;
    --txt-dd: #999;

    box-sizing: border-box;

    font-family: roboto;
}

body {
    margin: 0;
    color: var(--txt);
}

body, .panel {
    background-color: var(--bg);
}

.panel {
    position: absolute;
    width: 100vw;
    height: 100vh;
    left: 0;
    top: 0;

    z-index: -10;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.panel.hidden {
    display: none;
}


*::selection {
    background-color: var(--prim);
}

button, input {
    background-color: var(--bg-ll);
    border: 0;
    color: white;
    padding: 6px 15px;
    font-size: 1.3rem;
    cursor: pointer;

    transition: 200ms;
}

*:focus-visible {
    outline: 4px solid var(--prim);
    border-radius: 3px;
    border: none;
}

button:hover {
    transform: scale(1.1);
}

button.connecting {
    opacity: 0.5;
    color: transparent;
    position: relative;
}

button.connecting::after {
    content: "Connecting...";
    color: var(--txt-d);
    display: block;
    position: absolute;
    width: 100%;
    left: 0;
    top: 50%;
    transform: translate(0, -50%);
    text-align: center;
    line-height: 100%;
}


.sep-text {
    position: relative;
    display: block;
    margin: 20px;
    color: var(--txt-d);
    text-align: center;
    background-color: var(--bg);
    padding: 0 10px;
}

.sep-text::before {
    content: " ";
    display: block;
    width: 400px;
    height: 2px;
    background-color: var(--txt-d);
    position: absolute;
    top: calc(50% - 1px);
    left: calc(-200px + 50%);
    z-index: -5;
}

.flex-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.flex-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.text-margins {
    margin-left: 1em;
    margin-right: 1em;
}

#room-code {
    margin: 10px;
    font-size: 4rem;
    font-family: cascadia;
}

.room-code-clipboard-hint {
    color: var(--txt-d);
    font-style: italic;
}

.waiting-player-hint {
    color: var(--txt-d);
    margin-top: 30px;
    font-size: 1.5rem;
}

.room-join-error {
    color: #e24e4e;
    margin-top: 40px;
}

.room-join-error.hidden {
    display: none;
}

#game-hint {
    font-size: 1.7rem;
    text-align: center;
    margin-bottom: 5px;
}

#game-hint-2 {
    font-size: 1rem;
    text-align: center;
    color: var(--txt-d);
    font-style: italic;
    height: 30px;
}

#solution-hint {
    font-family: cascadia;
}

.sub-hidden {
    display: none;
}

.logo {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-bottom: 100px;
}

.logo .word-grid-cell {
    opacity: 0;
}

.logo .word-grid-cell.animate-hint {
    opacity: 1;
}

.server-url-panel {
    position: absolute;
    right: 10px;
    top: 10px;
    opacity: 0;
}

.server-url-panel:hover {
    opacity: 1;
}


.server-url-panel input {
    padding: 4px 10px;
    font-size: 1rem;
    margin-left: 5px;
}

#loading-screen {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 10000;
    background-color: var(--bg);

    display: flex;
    align-items: center;
    justify-content: center;
}

#loading-screen.hidden {
    display: none;
}

#loading-screen span {
    font-size: 3rem;
    color: var(--txt-d);
}

#start-options.animate {
    animation: start-options-animation 500ms ease 0s 1 forwards;
}

@keyframes start-options-animation {
    0% {
        margin-top: 150px;
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

#version {
    position: absolute;
    left: 10px;
    top: 10px;
    color: var(--txt-dd);
    font-family: cascadia;
}

/* WORD GRID */

.word-grid {
    display: grid;
    grid-template-columns: repeat(5, auto);
    gap: 5px;
    margin: 30px 50px 50px 50px;

    transition: 200ms;
}

.word-grid.inactive {
    opacity: 0.6;
}

.word-grid-cell {
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-grid-cell.empty {
    border: 2px solid var(--bg-ll);
}

.word-grid-cell.typed-unchecked {
    border: 2px solid var(--bg-lll);
}

.word-grid-cell.hint-green {
    background-color: var(--hint-green);
}

.word-grid-cell.hint-yellow {
    background-color: var(--hint-yellow);
}

.word-grid-cell.hint-red {
    background-color: var(--hint-red);
}

.word-grid-cell.hint-none {
    background-color: var(--bg-ll);
}

.word-grid-cell.sabotage-target {
    border-color: var(--hint-red);
    transition: 150ms;
}
.word-grid-cell.sabotage-target:hover {
    border-width: 6px;
}

.word-grid-label {
    font-size: 2.2rem;
    pointer-events: none;
    user-select: none;
    font-family: cascadia;
}

.word-grid-cell.animate-type {
    animation: word-grid-type 100ms ease 0s 1 forwards;
}
.word-grid-cell.animate-hint {
    animation: word-grid-hint 200ms ease 0s 1 forwards;
}
.word-grid-cell.invalid-animation {
    animation: word-grid-invalid 300ms ease 0s 1 forwards;
}
.word-grid-cell.win-animation {
    transition: 300ms;
    animation: 
        word-grid-win-start 700ms ease-in-out 0s 1 forwards,
        word-grid-win-loop 1000ms alternate infinite ease-in-out 700ms;
    box-shadow: 0 0 10px -3px var(--bg);
}
.word-grid-cell.win-animation .word-grid-label {
    animation: 
        word-grid-win-label 700ms ease-in-out 0s 1 backwards;
}

@keyframes word-grid-type {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes word-grid-hint {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0, 1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes word-grid-invalid {
    0% {
        transform: translate(0, 0);
    }
    20% {
        transform: translate(10px, 0);
    }
    40% {
        transform: translate(-10px, 0);
    }
    60% {
        transform: translate(10px, 0);
    }
    80% {
        transform: translate(-10px, 0);
    }
    100% {
        transform: translate(0, 0);
    }
}

@keyframes word-grid-win-start {
    0% {
        transform: translate(0, 0) rotate(0);
    }
    100% {
        transform: translate(0, 10px) rotate(360deg);
    }
}

@keyframes word-grid-win-label {
    0% {
        transform: rotate(0);
    }
    99% {
        transform: rotate(-359deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

@keyframes word-grid-win-loop {
    0% {
        transform: translate(0, 10px);
    }
    100% {
        transform: translate(0, -10px);
    }
}

/* KEYBOARD */

#keyboard {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    gap: 7px;
    width: 550px;
}

.keyboard-line {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: stretch;
    height: 60px;
    gap: 7px;
}

.keyboard-letter, .keyboard-enter, .keyboard-backspace {
    border: 2px solid var(--bg-ll);
    width: 1px;
    flex-grow: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: 600ms;
}

.keyboard-enter, .keyboard-backspace {
    flex-grow: 1.5;
}

.keyboard-void {
    width: 1px;
    flex-grow: 0.3;
}

.keyboard-letter > span {
    font-size: 1.6rem;
}

.keyboard-enter > span{
    font-size: 1.2rem;
}

.keyboard-backspace > span {
    font-size: 0.8rem;
}

.keyboard-letter:hover, .keyboard-enter:hover, .keyboard-backspace:hover {
    filter: brightness(1.2);
}

.keyboard-letter *, .keyboard-enter *, .keyboard-backspace * {
    pointer-events: none;
    user-select: none;
}

.keyboard-letter.hint-gray {
    background-color: var(--bg-ll);
    border-color: var(--bg-ll);
}

.keyboard-letter.hint-green {
    background-color: var(--hint-green);
    border-color: var(--hint-green);
}

.keyboard-letter.hint-red {
    background-color: var(--hint-red);
    border-color: var(--hint-red);
}

.keyboard-letter.hint-yellow {
    background-color: var(--hint-yellow);
    border-color: var(--hint-yellow);
}

/* TOASTS */

#toasts-container {
    position: absolute;
    width: 100vw;

    display: flex;
    justify-content: center;
    align-items: center;

    transition: 400ms ease-out;
}

#toasts-container {
    top: -100px;
    transform: scale(0.5);
}

#toasts-container.visible {
    top: 20px;
    transform: scale(1);
}

.toast {
    display: block;
    background-color: var(--bg-lll);
    padding: 7px 14px;
}

.toast.error {
    background-color: var(--hint-red);
}

.toast.hidden {
    display: none;
}

/* RESPONSIVENESS */

@media (max-width: 1000px) {
    #grids-container {
        width: fit-content;
        padding: 0 calc(50vw - 20px - 2.5*70px - 10px);
    }

    #grids-scroll-area {
        width: 100vw;
        overflow-x: auto;
    }

    #left-grid, #right-grid {
        margin: 30px 20px 50px 20px;
    }

    #keyboard {
        width: 95vw;
        margin-bottom: 30px;
        gap: 4px;
    }

    .keyboard-line {
        height: 75px;
        gap: 4px;
    }
}

@media (max-width: 600px) {
    #join-room-row {
        flex-direction: column;
        gap: 10px;
    }

    .logo .word-grid-cell-container, .logo .word-grid-cell {
        width: 60px;
        height: 60px;
    }
}

@media (max-height: 950px) {
    #left-grid, #right-grid {
        margin: 10px 20px 40px 20px;
    }

    .keyboard-line {
        height: 65px;
    }

    .word-grid-cell {
        height: 65px;
        width: 65px;
    }

    #grids-container {
        padding: 0 calc(50vw - 20px - 2.5*65px - 10px);
    }
}

@media (max-height: 850px) {
    .keyboard-line {
        height: 65px;
    }

    .word-grid-cell {
        height: 60px;
        width: 60px;
    }

    #grids-container {
        padding: 0 calc(50vw - 20px - 2.5*60px - 10px);
    }
}
/* FONTS */

@font-face {
    font-family: cascadia;
    src: url(fonts/CascadiaCode-Bold.ttf);
}

@font-face {
    font-family: roboto;
    src: url(fonts/Roboto-Light.ttf);
}

