@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --white: rgb(216, 222, 233);
    --transparent-white: rgba(255, 255, 255, .25);
    --dark: rgb(46, 52, 64);
    --dark-orange: rgb(238, 122, 44);
    --light-orange: rgb(250, 164, 29);
    --pistachio: #65a30d;
}

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

body {
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    padding: .3rem .35rem 0;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    color: var(--white);
    background-color: var(--dark);
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

header {
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.game-info {
    visibility: hidden;
}

.game-info, .score-container {
    padding: 1rem 0 1.5rem;
    display: none;
}

.game-info {
    display: none;
    visibility: hidden;
}

.score-container {
    display: none;
}

.middle-info {
    text-align: center;
    align-self: flex-start;
}

#end-game {
    padding: 8px 16px;
    margin-left: 2rem;
    color: rgba(216, 222, 233, .4);
    border: 1px solid rgba(216, 222, 233, .4);
    background-color: transparent;
    cursor: pointer;
}

.grid-controls {
    width: 60%;
    display: flex;
    flex-direction: column;
    row-gap: 12px;
    flex-grow: 1;
}

.columns, .rows {
    display: flex;
    justify-content: start;
    align-items: center;
}

.columns label, .rows label {
    width: 24%;
    margin-right: 24px;
}

input[type="range"] {
    width: 60%;
    height: 7px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--white);
    background-image: linear-gradient(to right, var(--light-orange), var(--dark-orange));
    background-size: 0% 100%;
    background-repeat: no-repeat;
    border-radius: 5px;
}

input[type="range"]::-moz-range-thumb {
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    background-color: var(--dark-orange);
    border: 1px solid var(--white);
    border-radius: 25%;
}

input[type="range"]::-moz-range-thumb:hover {
    width: 20px;
    height: 20px;
    cursor: grab;
}

input[type="range"]::-moz-range-thumb:active {
    width: 20px;
    height: 20px;
    cursor: grabbing;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background-color: var(--dark-orange);
    border: 1px solid var(--white);
    border-radius: 25%;
}

input[type="range"]::-webkit-slider-thumb:hover {
    width: 20px;
    height: 20px;
    cursor: grab;
}

input[type="range"]::-webkit-slider-thumb:active {
    width: 20px;
    height: 20px;
    cursor: grabbing
}

input[type="number"] {
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
    width: 2rem;
    margin-left: 0.35rem;
    text-align: center;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--white);
    border: 1px solid var(--white);
    border-radius: 3px;
  }
  
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
  }

input[type="number"]:focus {
    outline: none;
    border: 1px solid var(--dark-orange);
}

.game-controls {
    align-self: flex-end;
}

.game-controls button, .win-screen > div > button {
    padding: 8px 16px;
    color: var(--white);
    font-weight: 500;
    border: 2px solid var(--pistachio);
    background-color: var(--pistachio);
    border-radius: 3px;
    cursor: pointer;
}

.game-controls button:hover, .win-screen > div > button:hover {
    background-color: var(--pistachio)d0;
    border-color: var(--pistachio)d0;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(64px, 200px));
    justify-content: center;
    align-content: center;
    justify-items: center;
    gap: 16px;
    position: relative;
    transition: gap 1s ease-out, transform 4s ease-out;
}

.grid-container::after {
    width: 100%;
    height: 100%;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: pre;
    background-color: var(--transparent-white);
}

.loading-info {
    display: none;
    top: 30%;
    position: absolute;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-info p:last-child {
    padding-top: 1.5rem;
}

.loading-progress {
    width: 75px;
    height: 75px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.loading-progress::before {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    border: 4px solid transparent;
    border-top-color: var(--dark-orange);
    border-bottom-color: var(--pistachio);
    border-radius: 50%;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

.grid-container > div::before {
    content: '';
    width: 0;
    padding-bottom: 100%;
    grid-row: 1 / 1;
    grid-column: 1 / 1;
}

.grid-container > *:first-child {
    grid-row: 1 / 1;
    grid-column: 1 / 1;
}

.item {
    width: 100%;
    max-width: 200px;
    border: 1px solid rgba(216, 222, 233, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-position: center;
    background-repeat: no-repeat;
    border-color: var(--transparent-white);
    background-size: cover;
}

.square {
    width: 50px;
    height: 50px;
    border: 2px solid var(--white);
    border-radius: 5px;
    position: absolute;
    top: 0;
    left: 0;
    transition: top 1s ease-in-out, left 1s ease-in-out ;
}

.icon-success {
    color: var(--pistachio);
    padding: 25%;
}

.icon-fail {
    color: #e53539;
    padding: 25%;
}

.win-screen {
    text-align: center;
    position: absolute;
    top: 25%;
    z-index: -1;
    display: none;
}

.win-screen > div > h3 {
    color: var(--pistachio);
    -webkit-text-stroke: 20px var(--white);
    font-size: 5rem;
    position: relative;
    margin-bottom: 2rem;
}

.win-screen > div > h3::after {
    content: 'You win!';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    -webkit-text-stroke: 0px white;
}

.win-screen > div > button {
    margin-top: 3.5rem;
}