:root {
    --background: #ececec;
    --primary: #f53737;
    --primary-hover: #bb2e2e;
    --secondary: #fa6464;
    --text: #131313;
    --gray: #b6b6b6;
}

*,*::before,*::after {
  box-sizing:border-box;
}

body {
    font-family: "Inter", sans-serif;
    color: var(--text);
    min-height: 100vh;
    background-color: var(--background);
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.082) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.082) 1px, transparent 1px);
    background-size: 50px 50px;
    margin: 0;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/*Header*/

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    width: 100%;
    background: rgba(0, 0, 0, 0.041);
}

.header-title {
    color: var(--primary);
}

.header-stats {
    display: flex;
    gap: 2rem;
    border: 1px solid var(--text);
    border-radius: 15px;
    padding: 0rem 2rem;
}

.header-streak,
.header-best {
    color: var(--text);
    font-weight: 500;
}

/*Game*/

.game-container {
  min-block-size: 80svb;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 15px;
    margin-inline: 1rem;
    background: var(--background);
    border: 1px solid var(--secondary);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 12px 30px rgba(0, 0, 0, 0.15);
}

.game-task {
    user-select: none;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 600;
}

.game-input {
    background: none;
    border: none;
    border-bottom: 2px solid rgba(0,0,0,0.2);
    outline: none;
    padding: 0.75rem 0;
    width: 100%;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: 600;
    color: black;
    text-align: center;
    transition: border-bottom-color 0.2s ease;
}

.game-input:focus {
    border-bottom-color: rgba(0,0,0,0.6);
}

.game-input::placeholder {
    color: rgba(0,0,0,0.3);
    font-weight: 400;
}

.game-try {
    background-color: var(--secondary);
    border: none;
    color: var(--background);
    font-family: inherit;
    font-weight: 700;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}


.game-try:hover {
    background-color: var(--primary);
}

/*Footer*/

footer {
    display: flex;
    justify-content: center;
    font-size: 0.8rem;
    margin-top: auto;
}

footer a {
    color: var(--text);
}

/*Incorrect and overlay*/

.overlay {
    opacity: 0;
    pointer-events: none;
    position: fixed;
    background-color: rgba(0,0,0,0.7);
    inset: 0;
    z-index: 9;
    transition: opacity 0.2s ease;
}

.overlay.show {
    opacity: 1;
    pointer-events: all;
}

.incorrect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    border: none;
    padding: 2rem 4rem;
    align-items: center;
    background-color: var(--background);
    color: var(--text);
    flex-direction: column;
    display: flex;
    gap: 3rem;
    width: 100%;
    max-width: min(500px, 90%);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -60%);
    transition: opacity 0.2s ease, transform 0.2s ease;
    border-radius: 15px;
}

.incorrect.show {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%);
}

.incorrect-streak {
    border: 1px solid var(--text);
    padding: 1rem 2rem;
    border-radius: 15px;
}

.incorrect-reset {
    background-color: var(--secondary);
    border: none;
    color: var(--background);
    font-family: inherit;
    font-weight: 700;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s ease;
}


.incorrect-reset:hover {
    background-color: var(--primary);
}

@media (width < 500px) {
    header {
        flex-direction: column;
        padding-block: 1rem;
    }

    .game-container {
        min-height: 70svh;
    }
}