:root {
    --bg-color: #1A1C1A;
    --field-color: #4A4E46;
    --cell-color: #242622;
    --text-color: #C2C5BB;
    --dim-color: rgba(20, 22, 20, 0.9);
    --player-x: #FFFFFF;
    --player-o: #8A9A5B;
    --outcome-bg: #242622;
    --outcome-border: #8A9A5B;
    
    
    font-size: 16px;
}

html {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
}

main {
    display: grid;
    grid-template-areas: "game stats";
    align-items: center;
    justify-items: center;
    min-height: 100vh;
    padding: 20px;
}

/*playing field*/
#gameContainer {
    grid-area: game;
    width: clamp(400px, 90vw, 800px);
    aspect-ratio: 1 / 1; 
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    margin-top: 40px;
    background-color: var(--field-color);
    gap: 4px;
    border: 2px solid var(--field-color);
}

.cell {
    width: 100%;
    height: 100%;
    background-color: var(--cell-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.cell:hover {
    background-color: #242B35;
}

.cell i {
    font-size: clamp(5rem, 15vw, 10rem);
}

/* X and O styling*/
.fa-x, .fa-o {
    display: none;
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
}

.fa-x {
    color: var(--player-x);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1));
}

.fa-o {
    color: var(--player-o);
    filter: drop-shadow(0 0 12px var(--player-o));
}

/*Gameoutcome page styling*/
#gameoutcome {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 700px;
    height: 300px;
    transform: translate(-50%, -50%);
    background-color: var(--outcome-bg);
    border: 1px solid var(--field-color);
    color: var(--text-color);
    text-transform: uppercase;
    text-align: center;
    border-radius: 4px;
    padding: 20px;
    border-radius: 8px;
    z-index: 1000;
}

#restartBtn {
    width: 100px;
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--text-color);
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

#restartBtn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

#gameoutcome h2 {
    font-size: 4rem;
    margin-top: 20px;
    margin-bottom: 30px;
    gap: 20px;
}

#winner-icon i {
    display: inline-block; 
    font-size: 5rem;
    margin-bottom: 10px;
    vertical-align: middle;
}

#dim-overlay {
    display: none;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 500;
    position: fixed;
    background-color: rgba(0, 0, 0, 0.5);
}

/*stat display*/
#stats {
    grid-area: stats;
    min-width: 400px;
    margin-top: 40px;
}

#stats section{
    text-align: center;
}

#player-icon i {
    display: inline-block; 
    margin-right: 10px;
    font-size: 2rem;
}

#stats section p{
    font-size: 2rem;
}

#stats section span{
    font-size: 2rem;
}

/*Media Queries*/
/* Tablet */
@media screen and (max-width: 1024px) {
    main {
        grid-template-areas: 
            "game"
            "stats";
        justify-content: center;
    }

    #gameContainer {
        width: clamp(400px, 70vw, 550px);
        margin: 20px auto;
    }

    #stats {
        min-width: unset;
        width: 100%;
        display: flex;
        justify-content: space-around;
        margin-top: 20px;
    }
}

/* Phones */
@media screen and (max-width: 480px) {
    #gameContainer {
        width: 90vw;
        margin: 15px auto;
    }

    .cell i {
        font-size: 3rem;
    }

    #stats {
        flex-direction: column;
        gap: 10px;
    }

    #stats section p {
        font-size: 1.2rem;
    }

    #player-icon i {
        font-size: 1.5rem;
    }

    #gameoutcome {
        width: 90%;
        height: auto;
        padding: 30px 10px;
    }

    #gameoutcome h2 {
        font-size: 2rem;
        flex-direction: column;
    }

    #winner-icon i {
        font-size: 4rem !important;
    }
}

