@import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap');
:root {
    --primary-color: #323437;
    --secondary-color: #2c2e31;
    --tertiary-color: #e2b714;
    --text-color: #646669;
    --header-color: #d1d0c5;
    --wrong-color: #ca4754;
    --small-text: 1rem;
    --medium-text: 1.3rem;
    --large-text: 1.8rem;
    --xlarge-text: 4rem;
    --text-size: 1.5rem;
    --header-size: 3rem;
}

body,
html {
    font-size: 13px;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    /* outline: 1px solid red; */
    font-family: monospace;
    background-color: var(--primary-color);
    color: var(--text-color);
    user-select: none;
}


/* Input styles */

.textbox-control {
    display: block;
    padding: 0.4rem 1rem;
    border-radius: 0.25rem;
    border: 2px solid var(--text-color);
    outline: none;
    box-sizing: border-box;
    transition: border-color 200s ease-in-out;
    color: var(--header-color);
    caret-color: var(--tertiary-color);
}


/* Button styles */

.button-control {
    outline: none;
    border: none;
    border-radius: 5px;
    padding: .5rem 1rem;
    background-color: var(--secondary-color);
    color: var(--header-color);
}

.button-control:hover {
    background-color: var(--header-color);
    color: var(--secondary-color);
}

.button-control:active {
    background-color: var(--tertiary-color);
    color: var(--secondary-color);
    opacity: .9;
}


/* CSS for selected texts */

::selection {
    background: var(--tertiary-color);
    color: var(--primary-color);
}


/* Container for the whole website */

.whole {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    max-width: 1250px;
    padding: 1rem;
    margin: 0 auto;
}


/* Navigation */

nav {
    display: flex;
    flex: 0 1 auto;
}

nav p {
    font-weight: bolder;
    color: var(--header-color);
    flex: 0 1 auto;
    font-size: var(--header-size);
}

nav svg {
    fill: var(--tertiary-color);
    height: var(--large-text);
    width: fit-content;
    margin-top: .3rem;
    font-family: 'Varela Round';
}

nav .logo {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .5rem;
    align-items: center;
}

nav span {
    color: var(--tertiary-color);
}

nav .nav-buttons {
    display: flex;
    flex: 1 1 auto;
    gap: 3rem;
    align-items: center;
    justify-content: end;
}

nav button {
    outline: none;
    border: none;
    color: var(--text-color);
    font-size: var(--medium-text)
}

nav button:hover>i {
    cursor: pointer;
}

nav button:first-child>i {
    color: var(--tertiary-color);
}

nav button:not(:first-child):hover>i {
    color: var(--header-color);
}

nav button.active>i {
    color: var(--header-color);
}


/* Custom tooltip for icons */

[data-title]:hover:after {
    opacity: 1;
    transition: all 0.1s ease 0.5s;
    visibility: visible;
}

[data-title]:after {
    content: attr(data-title);
    background-color: var(--secondary-color);
    color: var(--tertiary-color);
    font-size: var(--small-text);
    position: absolute;
    padding: .5rem;
    bottom: -2em;
    right: 100%;
    white-space: nowrap;
    box-shadow: 1px 1px 3px #222222;
    opacity: 0;
    border-radius: .3rem;
    z-index: 10;
    visibility: hidden;
}

[data-title] {
    position: relative;
}


/* Body */

.body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


/* Game settings */

.body .game-settings {
    margin-top: auto;
    background-color: var(--secondary-color);
    height: 5rem;
    display: grid;
    grid-template-columns: repeat(3, auto);
    align-items: center;
    gap: 2rem;
    padding: 0 5rem;
    border-radius: 10px;
}

.body .game-settings label {
    background-color: var(--secondary-color);
    font-size: var(--medium-text);
    cursor: pointer;
}

.body .game-settings input[type=radio] {
    display: none;
}

.body .game-settings input[type=radio]:hover+label,
.body .game-settings input[type=radio]:hover+label>i {
    color: var(--header-color) !important;
}

.body .game-settings input[type=radio]:checked+label,
.body .game-settings input[type=radio]:checked+label>i {
    color: var(--tertiary-color);
}

.body .game-settings span {
    background-color: var(--secondary-color);
    display: none;
}

.body .game-settings i {
    background-color: var(--secondary-color);
}

.body .game-settings input#mode:checked~#mode-input,
.body .game-settings input#word:checked~#word-input {
    display: flex;
    padding: 0 2rem;
    border-left: 2px solid var(--text-color);
}

.body .game-settings input::-webkit-outer-spin-button,
.body .game-settings input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.body .game-settings input[type=number] {
    -moz-appearance: none;
}

.body .game-settings #mode-input {
    gap: 1rem;
}


/* Word count */

.body .word-count {
    display: flex;
    width: 100%;
}

.body .word-count>p:nth-child(2) {
    color: var(--header-color);
    margin-left: auto;
}

.body .word-count>p:nth-child(3) {
    color: var(--header-color);
    margin-left: 5rem;
}

.body .word-count p:not(:nth-child(1)) {
    display: none;
}

.body .word-count span {
    color: var(--tertiary-color);
}

.body .word-count p {
    font-size: var(--large-text);
    color: var(--tertiary-color);
    user-select: none;
    padding: .5rem;
}


/* Textarea */

.paragraph {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .5rem;
    border-radius: 10px;
    width: 100%;
}

.paragraph textarea {
    resize: none;
    border: none;
    width: 100%;
    outline: none;
    font-size: var(--large-text);
    caret-color: var(--tertiary-color);
    overflow: hidden;
    z-index: 0;
}

.paragraph textarea::selection {
    background: var(--primary-color);
    color: var(--text-color);
}

canvas {
    width: 100% !important;
}

mark:hover {
    cursor: pointer;
}

.paragraph-buttons {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 5rem;
    margin: 2rem 0;
}

.paragraph-buttons>button {
    border: none;
    outline: none;
    height: 2rem;
    width: 4rem;
    border-radius: 2px;
}

.paragraph-buttons>button:hover>i {
    color: var(--header-color);
}

.paragraph-buttons>button:focus {
    outline: 2px solid var(--header-color);
}

.paragraph-buttons>button:active {
    outline: none;
}

.paragraph-buttons>button>i {
    cursor: pointer;
    font-size: var(--medium-text);
}


/* Legend */

.legends {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.legends .legend {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.legends p.block {
    color: var(--primary-color);
    background-color: var(--text-color);
    padding: .5rem;
    border-radius: 3px;
}


/* History */

#history-body {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1 1 auto;
    width: 100%;
    margin: 0 auto;
}

#history-body>div:first-child {
    font-size: var(--large-text);
    font-weight: 1000;
    color: var(--header-color);
}

.history-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    width: 90%;
}

.history-logs {
    height: 200px;
    width: 100%;
}


/* Contact links */

.contacts {
    display: grid;
    grid-template-columns: 10rem 10rem;
    width: fit-content;
    gap: 1rem;
}

.contacts a {
    text-decoration: none;
}

.links {
    display: flex;
}

.links:hover>i,
.links:hover>p {
    cursor: pointer;
    color: var(--header-color);
}

.links i {
    margin-right: .5rem;
    height: 1rem;
    width: 1rem;
}

.links p {
    font-size: var(--small-text);
}


/* Footer */

footer {
    flex: 0 1 fit-content;
    text-align: center;
    user-select: all;
}


/* Current test logs chart */

.test-logs {
    display: none;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: .5rem;
    width: 100%;
}

.wpm_accuracy_text * {
    display: block;
    font-size: var(--xlarge-text);
    line-height: var(--xlarge-text);
}

.wpm_accuracy_text span[id],
.wpm_accuracy_text p {
    display: inline-block;
    color: var(--tertiary-color);
}

.wpm_accuracy_text>span:nth-child(odd) {
    font-size: var(--header-size);
}

#test-chart {
    width: 100%;
    height: 200px;
}


/* Loading */

#loading {
    display: none;
}

.loader {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
    animation: rotate 1s linear infinite;
}

.loader::before {
    content: "";
    box-sizing: border-box;
    position: absolute;
    inset: 0px;
    border-radius: 50%;
    border: 5px solid var(--tertiary-color);
    animation: prixClipFix 2s linear infinite;
}


/* Notification 
rgba(241,51,34,.71) --> bad border
rgba(138,18,12,.9) --> bad background
*/

.notification-center {
    position: fixed;
    display: grid;
    top: 1rem;
    right: 1rem;
    gap: 1rem;
}

.notification-center>* {
    border: 2px solid;
    border-radius: 10px;
    padding: 1rem;
}

.notification-message {
    background-color: rgb(5, 138, 5);
    border-color: rgb(72, 186, 73);
}

.notification-error {
    background-color: rgba(138, 18, 12, .9);
    border-color: rgba(241, 51, 34, .71);
}

.notification-center>div:hover {
    cursor: pointer;
    opacity: .6;
}

.message {
    display: grid;
    align-items: center;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    background-color: inherit;
    max-width: 15rem;
    gap: .2rem;
    column-gap: .6rem;
}

.message * {
    background-color: inherit;
}

.message i,
.message .title,
.message .message-text {
    font-size: calc(var(--small-text) + .2rem);
    color: white;
}

.message i {
    font-size: 1rem;
}

.message .message-text {
    grid-column: 1/3;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg)
    }
}

@keyframes prixClipFix {
    0% {
        clip-path: polygon(50% 50%, 0 0, 0 0, 0 0, 0 0, 0 0)
    }
    25% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 0, 100% 0, 100% 0)
    }
    50% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 100% 100%, 100% 100%)
    }
    75% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 100%)
    }
    100% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 0)
    }
}


/* Class for elements that will show/hide when typing */

.focusable {
    transition-timing-function: ease-out;
    transition: visibility 0.2s;
}


/* Responsive Design */

@media only screen and (max-width: 560px) {
     :root {
        --text-size: 1.3rem;
        --header-size: 2.5rem;
        --medium-text: 1.2rem;
        --large-text: 1.5rem;
        --xlarge-text: 3.5rem;
    }
    body,
    html {
        font-size: 12px;
    }
    nav p {
        display: none;
    }
    nav svg {
        margin-top: 0;
    }
    .body .game-settings {
        width: 100%;
        padding: 0 0 0 1rem;
    }
    .body .game-settings input#mode:checked~#mode-input,
    .body .game-settings input#word:checked~#word-input {
        padding: 0 1rem 0 2rem
    }
    .body .game-settings label {
        font-size: var(--small-text);
    }
    .paragraph mark {
        font-size: var(--large-text);
    }
    .test-logs,
    .history-container {
        grid-template-columns: none;
        grid-template-rows: auto 1fr;
    }
    .wpm_accuracy_text {
        margin: 0 auto;
        display: grid;
        gap: 3rem;
        grid-template-columns: repeat(2, 1fr);
    }
    .contacts {
        width: 100%;
        margin: 1rem 0;
        display: flex;
        justify-content: space-between;
    }
    #words-input {
        width: 7rem;
    }
    .code-link {
        width: 100%;
    }
    .message {
        max-width: 10rem;
    }
}

@media only screen and (max-height: 460px) {
    .whole {
        height: 80vw;
    }
}