/* =========================
   BODY
========================= */

body {
    background-color: rgb(209, 177, 156);

    font-family: Arial, Helvetica, sans-serif;

    color: white;

    text-align: center;

    margin: 0;
    padding: 20px;
}


/* =========================
   TITLE
========================= */

h1 {
    margin-bottom: 20px;
    font-size: 50px;
}


/* =========================
   WINDOW
========================= */

#window {
    position: relative;

    width: 600px;
    height: 600px;

    margin: 0 auto;

    overflow: hidden;
}


/* =========================
   WINTER BACKGROUND
========================= */

#window::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    z-index: 0;

    background:

        /* Snow */
        radial-gradient(
            circle at 20% 25%,
            white 0px,
            white 4px,
            transparent 5px
        ),

        radial-gradient(
            circle at 70% 20%,
            white 0px,
            white 3px,
            transparent 4px
        ),

        radial-gradient(
            circle at 40% 55%,
            white 0px,
            white 5px,
            transparent 6px
        ),

        radial-gradient(
            circle at 85% 70%,
            white 0px,
            white 4px,
            transparent 5px
        ),

        /* Sky */
        linear-gradient(
            rgb(159, 207, 233),
            rgb(215, 235, 245)
        );
}


/* =========================
   GAME BOARD
========================= */

#game-board {
    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background: linear-gradient(
        rgba(228, 247, 251, 0.35),
        rgba(235, 248, 250, 0.25)
    );

    backdrop-filter: blur(4px);

    color: rgb(30, 60, 80);

    display: grid;

    grid-template:
        repeat(3, 1fr)
        /
        repeat(3, 1fr);

    z-index: 2;

    box-shadow:
        inset 0 0 35px
        rgba(255, 255, 255, 0.8);
}


/* =========================
   FOG EFFECT
========================= */

#game-board::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;

    background:

        radial-gradient(
            circle at 20% 30%,
            rgba(255, 255, 255, 0.45),
            transparent 25%
        ),

        radial-gradient(
            circle at 75% 65%,
            rgba(255, 255, 255, 0.35),
            transparent 30%
        ),

        radial-gradient(
            circle at 50% 10%,
            rgba(255, 255, 255, 0.3),
            transparent 20%
        );

    opacity: 0.8;

    z-index: 5;
}


/* =========================
   GAME CELLS
========================= */

.game-cell {
    position: relative;

    border: 4px solid rgba(255, 255, 255, 0.5);

    font-size: 100px;

    font-weight: bold;

    color: rgba(141, 198, 255, 0.8);

    text-shadow:
        0 0 5px rgba(255, 255, 255, 0.9),
        1px 1px 4px rgba(100, 140, 155, 0.25);

    display: flex;

    justify-content: center;

    align-items: center;

    z-index: 6;

    background-color:
        rgba(220, 240, 245, 0.12);

    transition:
        background-color 0.3s,
        transform 0.2s;
}


/* Cell hover */

.game-cell:hover {
    background-color:
        rgba(255, 255, 255, 0.25);

    transform: scale(0.98);
}


/* =========================
   WINNING CELLS
========================= */

.winning-game-cell {
    background-color:
        rgba(255, 255, 255, 0.35);

    color: white;

    box-shadow:
        inset 0 0 20px
        rgba(255, 255, 255, 0.7);
}


/* =========================
   CURTAINS
========================= */

#curtain-left,
#curtain-right {
    position: absolute;

    top: 0;

    width: 50%;
    height: 100%;

    background:
        repeating-linear-gradient(
            90deg,

            rgb(90, 25, 45) 0px,

            rgb(120, 40, 60) 12px,

            rgb(150, 55, 75) 24px,

            rgb(100, 30, 50) 36px,

            rgb(80, 20, 40) 48px
        );

    z-index: 10;

    cursor: pointer;

    transition:
        transform 1.5s ease-in-out;
}


/* Left curtain */

#curtain-left {
    left: 0;

    border-right:
        5px solid rgb(90, 25, 45);
}


/* Right curtain */

#curtain-right {
    right: 0;

    border-left:
        5px solid rgb(90, 25, 45);
}


/* Open curtains */

#window.open #curtain-left {
    transform: translateX(-100%);
}

#window.open #curtain-right {
    transform: translateX(100%);
}


/* =========================
   WINNER POPUP
========================= */

#winner-popup {
    position: absolute;

    top: 50%;
    left: 50%;

    width: 60%;

    max-width: 300px;

    z-index: 20;

    opacity: 0;

    transform:
        translate(-50%, -50%)
        scale(0);

    transition:
        opacity 0.4s ease,
        transform 0.4s ease;

    pointer-events: none;

    text-align: center;
}


/* Show popup */

#winner-popup.show {
    opacity: 1;

    transform:
        translate(-50%, -50%)
        scale(1);

    pointer-events: auto;
}


/* Winner image */

#winner-image {
    width: 100%;

    height: auto;

    display: block;

    object-fit: contain;

    border-radius: 15px;
}


/* =========================
   REJOUER BUTTON
========================= */

#close-winner {
    margin-top: 15px;

    padding: 8px 20px;

    border: 5px solid white;

    border-radius: 5px;

    background-color:
        rgb(120, 40, 60);

    color: white;

    font-size: 18px;

    cursor: pointer;

    transition:
        transform 0.2s,
        background-color 0.2s;
}


/* Button hover */

#close-winner:hover {
    transform: scale(1.05);

    background-color:
        rgb(150, 55, 75);
}


/* =========================
   MOBILE FRIENDLY
========================= */

@media screen and (max-width: 600px) {

    body {
        padding: 10px;

        overflow-x: hidden;
    }


    h1 {
        font-size: 32px;
    }


    #window {
        width: 90vw;

        height: 90vw;

        max-width: 600px;

        max-height: 600px;
    }


    .game-cell {
        font-size: 18vw;

        border-width: 2px;
    }


    #winner-popup {
        width: 65vw;

        max-width: 250px;
    }


    #winner-image {
        max-height: 40vh;

        object-fit: contain;
    }


    #close-winner {
        font-size: 16px;

        padding: 7px 18px;
    }

}