@import url('https://fonts.googleapis.com/css2?family=Baloo+Bhaina+2&family=Roboto&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

nav {
    background-color: rgb(37, 9, 37);
    color: white;
    height: 65px;
    font-size: 27px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-family: 'Roboto', sans-serif;
}

nav ul {
    list-style-type: none;
}

/* Start Page Styling */
@keyframes colorSizeAnimation {
    0% {
        color: blue;
        font-size: 2em;
    }
    50% {
        color: red;
        font-size: 2.5em;
    }
    100% {
        color: blue;
        font-size: 2em;
    }
}

.heading {
    animation: colorSizeAnimation 2s infinite;
}

@keyframes colorChange {
    0%, 20% { background-color: #a8c8e8; }
    20%, 40% { background-color: #f0f4f8; }
    40%, 60% { background-color: #e7e1f5; }
    60%, 80% { background-color: #d1e8d5; }
    80%, 100% { background-color: #ffe6d2; }
}

.start-page {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    animation: colorChange 10s infinite;
    text-align: center;
}

.start-container h1 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.start-gif {
    width: 200px;
    height: auto;
    margin-bottom: 20px;
}

#start-game {
    padding: 12px 24px;
    background-color: #8c6a8c;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

#start-game:hover {
    background-color: #6d4b6d;
    transform: scale(1.15);
}

#selectmode {
    margin-top: 20px;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
}

/* Game page styling */
#game-page {
    display: none;
}

#game-page.active {
    display: block;
}

/* Game container styling */
.gameContainer {
    display: flex;
    justify-content: center;
    margin-top: 50px;
}

.container {
    display: grid;
    grid-template-columns: repeat(3, 10vw);
    grid-template-rows: repeat(3, 10vw);
    font-family: 'Roboto', sans-serif;
    position: relative;
    gap: 5px;
}

.box {
    border: 2px solid black;
    font-size: 8vw;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    transition: background-color 0.2s, transform 0.2s;
}

.box:hover {
    background-color: rgb(204, 195, 212);
}

.box:active {
    transform: scale(0.95);
}

/* Game info styling */
.info {
    font-size: 22px;
    margin-top: 20px;
    text-align: center;
}

.gameInfo {
    padding: 0 34px;
    font-family: 'Baloo Bhaina 2', cursive;
    text-align: center;
}

.gameInfo h1 {
    font-size: 2.5rem;
}

.imgbox img {
    width: 0;
    transition: width 1s ease-in-out;
}

.br-0 {
    border-right: 0;
}

.bl-0 {
    border-left: 0;
}

.bt-0 {
    border-top: 0;
}

.bb-0 {
    border-bottom: 0;
}

/* Winner overlay specific to the grid area */
.winner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* semi-transparent black */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2; /* Ensure it's above the game boxes */
}

.winner-overlay p {
    font-size: 4rem;
    color: white;
    font-family: 'Baloo Bhaina 2', cursive;
}

/* Reset and Back to Menu button styling */
#reset, #back-to-menu {
    margin: 0 23px;
    padding: 10px 20px;
    background: #8c6a8c;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    font-weight: bold;
    color: white;
    transition: background-color 0.3s, transform 0.3s;
}

#reset:hover, #back-to-menu:hover {
    background-color: #6d4b6d;
    transform: scale(1.15);
}

/* Line for winning strike */
.line {
    width: 0;
    height: 3px;
    position: absolute;
    background-color: palevioletred;
    transition: width 0.5s ease-in-out;
    z-index: 1;
}

.line.horizontal {
    top: 16.66%;
    left: 0;
    transform: translateY(-50%);
}

.line.vertical {
    left: 16.66%;
    top: 0;
    width: 3px;
    height: 100%;
}

.line.diagonal {
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    transform: rotate(45deg);
}

.line.reverse-diagonal {
    top: 0;
    right: 0;
    width: 100%;
    height: 3px;
    transform: rotate(-45deg);
}

/* Responsive adjustments */
@media screen and (max-width: 800px) {
    .gameContainer {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        margin-top: 50px; 
        transform: scale(1.1); 
        transform-origin: center; 
    }

    .gameInfo {
        margin-top: 34px;
    }

    .gameInfo h1 {
        font-size: 1.5rem;
    }

    .container {
        grid-template-columns: repeat(3, 30vw);
        grid-template-rows: repeat(3, 30vw);
    }

    .start-container h1 {
        font-size: 2rem;
    }

    #start-game {
        padding: 8px 16px;
        font-size: 1rem;
    }

    .start-gif {
        width: 150px;
    }

    #back-to-menu, #reset {
        padding: 8px 12px;
        font-size: 12px;
    }

    .box {
        font-size: 10vw; 
        padding: 10px; 
    }

    .winner-overlay p {
        font-size: 3rem;
    }
}
