@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700&family=Poppins:wght@300;400;500;600;700&family=Bebas+Neue&display=swap');

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Raleway', sans-serif;
    font-weight: bold;
}

body{
    background: #000814;
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

nav{
    min-height: 72px;
    width: 100%;
    padding: 12px 5px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background:#1d2d44 ;
    gap: 20px;
    height: 50px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.title{
    grid-column: 2;
    justify-self: center;
    font-size: 1.5rem;
    letter-spacing: 2px;
    color: white;
    animation: title 0.7s ease;
    transition: 0.2s ease;
}

.mode_btn{
    padding: 10px 14px;
    background: #334e68;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s ease;
}

.mode_btn:hover{
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

.controls{
    min-height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.controls label{
    font-weight: 600;
}

#level{
    padding: 7px 12px;
    border: none;
    border-radius: 10px;
    background: #adb5bd;
    color: #000814;
    font-weight: 700;
}

#level:disabled{
    opacity: 0.45;
    cursor: not-allowed;
}


h1{
    color: white;
    text-align: center;
    font-size: 1.5rem;

}

.container{
    min-height: 52vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game{
    width: min(90vw, 430px);
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(7px, 1.5vw, 12px);
}

.box{
    width: 100%;
    aspect-ratio: 1;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1),
                0 1px 3px rgba(0, 0, 0, 0.08),
                inset 0 -2px 2px rgba(0, 0 ,0 , 0.05);
    font-size: 1.5rem; 
    color: #cf5c36 ;  
    background:#adb5bd ;

    transition: transform 0.18s ease,
                background 0.18s ease,
                box-shadow 0.18s ease;
}

.box:hover:not(:disabled){
    transform: translateY(-4px) scale(1.02);
    background: #c8ced3;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.box:active:not(:disabled){
    transform: scale(0.94);
}

.box:disabled{
    cursor: default;
}

#turn{
    font-weight: bold;
    font-size: 1.2rem;
    transition:  0.2s ease;
}

#turn:hover{
    color: #ffc300;
    transform: translateY(-2px);
}


.btns{
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}



#reset_btn{
    padding: 1rem;
    font-size: 1rem;
    background: #e63946;
    color: #fff;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: 0.2s ease;
}

#new_game{
    padding: 1rem;
    font-size: 1rem;
    background:#ffb703;
    border-radius: 10px;
    color: #000814;
    border: none;
    cursor: pointer;
    transition: 0.2s ease;
}

#reset_btn:hover,
 #new_game:hover{
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

#reset_btn:active,
 #new_game:active{
    transform: scale(0.95);
 }



.win{
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    /* flex-direction: column; */
    /* gap: 4rem; */
    animation: pop 0.4s ease;
}

.hide{
    display: none;
}

#wins{
    color: #ffb703;
    font-size: 1.5rem;
    font-weight: bold;
}

.box.o{
    color: #e63946;
    animation: logo 0.25s ease;
}
.box.x{
    color: #219ebc ;
    animation: logo 0.25s ease;
}

.box.win-cell{
    background: #ffb703;
    color: #000814;
    animation: win 0.8s ease infinite alternate;
}

#turn {
    text-align: center;
    min-height: 25px;
    color: #ced4da;
    font-weight: 600;
    margin: 10px;
}


.btns{
    display: flex;
    justify-content: center;
    padding-bottom: 20px 15px 30px;
    gap: 18px;
}

.title:hover{
    color: #ffb703;
    cursor: pointer;
    transform: translateY(-3px);
}


@keyframes title{
    from{
        opacity: 0;
        transform: translateY(-15px);
    }

    to{
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logo{
    from{
        opacity: 0;
        transform: scale(0.4) rotate(-10deg);
    }
    to{
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes pop{
    from{
        opacity: 0;
        transform: scale(0.7);
    }

    to{
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes win {
    from{
        transform: scale(1);
    }

    to{
        transform: scale(1.04);
    }
}


@media (max-width: 700px){
    nav{
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 10px;
        padding: 12px;
    }

    .title{
        grid-column: 1;
        grid-row: 1;
    }

    .mode_btns{
        grid-column: 1;
        grid-row: 2;
        justify-items: center;
        width: 100%;
        max-width: 430px;
    }

    .mode_btn{
        flex: 1;
        font-size: 1rem;
        padding: 10px 8px;
    }

    .container{
        min-height: auto;
        padding: 25px 15px 18px;
    }

    .game{
        width: min(88vw, 380px);
    }

    .box{
        border-radius: 10px;
    }
}

@media (max-width: 480px){
    nav{
        min-height: 120px;
        height: auto;
        padding: 10px;
        gap: 8px;
    }
    .title{
        font-size: 2rem;
    }

    .mode_btns{
        display: flex;
        flex-direction: row;
        gap: 7px;
        width: 100%;
    }

    .mode_btn{
        font-size: 0.75rem;
        padding: 9px 6px;
    }
    .controls{
        margin-top: 10px;
    }

    .game{
        width: 88vw;
        gap: 6px;
    }

    .box{
        border-radius: 10px;
        font-size: 15vw;
    }

    .btns{
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    #reset_btn, #new_game{
        width: min(88vw, 380px);
    }
}

.mode_btn.active{
    background: #ffb703;
    color: #000814;
}
