/* body{
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.row{
    display: flex;
}
.col{
    height: 80px;
    width: 80px;
    border: 1px solid black;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    cursor: pointer;
} */

/* 1. Global Reset and Body Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    /* Changed to column to stack the new title above the container */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Adds space between title and container */
    gap: 30px;
    color: white;
    overflow: hidden;
}

.main-title {
    font-size: 6rem;
    font-weight: 900;
    letter-spacing: 5px;
    background: linear-gradient(to right, #240b36, #3a1c71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    /* A dark drop shadow to make it pop off the background */
    filter: drop-shadow(0px 5px 5px rgba(0, 0, 0, 0.5));
}

/* 2. Main Game Container */
.container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    transition: filter 0.5s ease, transform 0.5s ease;
}

/* 3. The Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

/* 4. The Cells (.col) */
.col {
    height: 100px;
    width: 100px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 0 0 0px rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.col:empty:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.col:not(:empty) {
    animation: popIn 0.3s forwards;
}

/* 5. Buttons */
.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

button {
    padding: 12px 25px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    color: white;
    background-size: 200% auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    background-position: right center;
}

button:active {
    transform: translateY(-1px);
}

#px {
    background-image: linear-gradient(to right, #FF512F 0%, #DD2476 51%, #FF512F 100%);
}

#ng,#newGameBtn {
    background-image: linear-gradient(to right, #00d2ff 0%, #3a7bd5 51%, #00d2ff 100%);
}

#px:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(80%);
    transform: none;
}

.col.X {
    color: #00e0ff;
    text-shadow: 0 0 20px rgba(0, 224, 255, 0.6);
}

.col.O {
    color: #ff3e6c;
    text-shadow: 0 0 20px rgba(255, 62, 108, 0.6);
}

/* 6. The Result Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.overlay.show {
    opacity: 1;
    pointer-events: all;
}

body.game-over .container {
    filter: blur(5px);
    transform: scale(0.95);
}

.result-box {
    background: white;
    color: #333;
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay.show .result-box {
    transform: scale(1);
    opacity: 1;
}

.result-box h2 {
    font-size: 3rem;
    margin-bottom: 30px;
    background: linear-gradient(to right, #FF512F, #DD2476);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/*Responsivness*/
@media (max-width: 600px) {

    .main-title {
        font-size: 4rem;
        /* Smaller title */
        letter-spacing: 2px;
        margin-top: 20px;
    }

    .container {
        padding: 25px 15px;
        width: 90%;
    }

    .col {
        height: 80px;
        width: 80px;
        font-size: 3.5rem;
        border-radius: 10px;
    }

    .grid {
        gap: 10px;
        margin-bottom: 25px;
    }

    .controls {
        flex-direction: column;
        width: 100%;
    }

    button {
        width: 100%;
        padding: 15px;
    }

    .result-box {
        width: 85%;
        padding: 30px 20px;
    }

    .result-box h2 {
        font-size: 2rem;
    }
}

/* For small devices */
@media (max-width: 350px) {
    .col {
        height: 70px;
        width: 70px;
        font-size: 3rem;
    }
}