@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    color: inherit;
}

body {
    font-family: 'Poppins', sans-serif;
    font-size: 62.5%;
    background-color: #eee;
    color: #333;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    font-weight: 300;
    position: relative;
    transition: background-color 0.3s ease-out;
}

body.dark-mode {
    background-color: #333 !important;
    color: #eee !important;
}

body.dark-mode .cell {
    border-color: #eee !important;
}

body.dark-mode .restart-btn {
    color: #eee;
}

body.dark-mode .restart-btn::after {
    background-color: #eee;
}

.dark-mode-btn {
    position: absolute;
    top: 0;
    right: 0;
    margin: 1.25rem 1.25rem 0 0;
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.3 ease;
}

.dark-mode-btn.dark-mode {
    transform: rotate(180deg);
}

.title {
    font-size: 36px;
    font-weight: 300;
}

.current-move {
    font-size: 1.25rem;
    font-weight: 400;
}

.restart-btn {
    outline: none;
    border: none;
    background-color: transparent;
    padding: 5px 10px;
    font-family: inherit;
    font-weight: 400;
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
}

.restart-btn::after {
    position: absolute;
    content: '';
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background-color: #333;
    transition: width 0.4s ease;
}

.restart-btn:hover::after {
    width: 0%;
}

.credits {
    position: absolute;
    bottom: 0;
    right: 0;
    margin: 0 1.25rem 1.25rem 0;
    font-size: clamp(0.75rem, 2.5vw, 1rem);
    font-weight: 400;
}

.grid {
    display: grid;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    height: clamp(300px, 35vw, 400px);
    aspect-ratio: 1;
}

.cell {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
}

.cell.draggable {
    color: #ffbc3e;
}

.cell.won {
    color: red;
}

.cell:first-child,
.cell:nth-child(2),
.cell:nth-child(4),
.cell:nth-child(5),
.cell:nth-child(7),
.cell:nth-child(8) {
    border-right: 1px solid #333;
}

.cell:nth-child(4),
.cell:nth-child(5),
.cell:nth-child(6),
.cell:nth-child(7),
.cell:nth-child(8),
.cell:nth-child(9) {
    border-top: 1px solid #333;
}

.cell:first-child,
.cell:nth-child(2),
.cell:nth-child(3),
.cell:nth-child(4),
.cell:nth-child(5),
.cell:nth-child(6) {
    border-bottom: 1px solid #333;
}

.cell:nth-child(2),
.cell:nth-child(3),
.cell:nth-child(5),
.cell:nth-child(6),
.cell:nth-child(8),
.cell:nth-child(9) {
    border-left: 1px solid #333;
}

.cell:first-child {
    grid-column: 1/2;
    grid-row: 1/2;
}

.cell:nth-child(2) {
    grid-column: 2/3;
    grid-row: 1/2;
}

.cell:nth-child(3) {
    grid-column: 3/4;
    grid-row: 1/2;
}

.cell:nth-child(4) {
    grid-column: 1/2;
    grid-row: 2/3;
}

.cell:nth-child(5) {
    grid-column: 2/3;
    grid-row: 2/3;
}

.cell:nth-child(6) {
    grid-column: 3/4;
    grid-row: 2/3;
}

.cell:nth-child(7) {
    grid-column: 1/2;
    grid-row: 3/4;
}

.cell:nth-child(8) {
    grid-column: 2/3;
    grid-row: 3/4;
}

.cell:nth-child(9) {
    grid-column: 3/4;
    grid-row: 3/4;
}
