/* Body and Background - ONLY THIS CHANGED */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: radial-gradient(circle at center, 
        #ff6b6b,  /* Coral Red */
        #feca57,  /* Mango Yellow */
        #48dbfb,  /* Sky Blue */
        #1dd1a1,  /* Mint Green */
        #5f27cd   /* Soft Purple */
    );
    background-attachment: fixed;
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    padding: 20px;
    box-sizing: border-box;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-container {
    display: flex;
    flex-direction: row; /* Row layout for desktop/laptop */
    justify-content: center;
    align-items: center;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
}

/* Overall container */
.container {
    background: linear-gradient(135deg, #ff6f61, #ffcc70, #c2f0a2, #63cdda, #845ec2);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.container h2 {
    margin-bottom: 25px;
    font-size: 40px;
}

/* Player Section */
.player {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
}

.player img {
    margin-top: 100px;
    width: 300px;
    height: 400px;
    border-radius: 50%;
}

.player button {
    background-color: #4CAF50;
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 30px;
    margin: 10px 20px;
}

/* Tic Tac Toe Board */
.board {
    display: grid;
    grid-template-columns: repeat(3, 120px);
    grid-gap: 20px;
    margin-bottom: 25px;
}

/* Each Cell */
.cell {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #fbc2eb, #a6c1ee);
    font-size: 50px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    border: 2px solid #333;
    cursor: pointer;
    transition: background 0.3s;
}

.cell:hover {
    background: #ddd;
}

/* Status message */
.winnign-message {
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: bold;
    color: rgb(232, 31, 9);
}

/* Restart button */
.restart-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 22px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.restart-btn:hover {
    background-color: #0056b3;
}

/* Animation: Zoom in/out for current player's turn */
.blink button,
.blink img {
    animation: zoomEffect 1.5s ease-in-out infinite;
}

@keyframes zoomEffect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Winner glow */
.winner-glow {
    box-shadow: 0 0 25px 8px rgba(225, 90, 17, 0.9);
    border-radius: 20px;
    transition: box-shadow 0.3s ease-in-out;
}

/* Draw message glow */
.draw-glow {
    color: #fff;
    background: linear-gradient(to right, #ff7300, #898703);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 0 25px 10px rgba(255, 166, 0, 0.8);
    display: inline-block;
}

.glow-text {
    color: #fff;
    background: linear-gradient(to right, #ff7300, #898703);
    font-size: 24px;
    padding: 10px 15px;
    border-radius: 10px;
}

/* Responsiveness for multiple screens */

@media (max-width: 768px) {
    body {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }

    .game-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    /* Order: Player1 -> Board -> Player2 */
    #player1 {
        order: 1;
        flex-direction: row !important;
    }

    .container {
        order: 2;
    }

    #player2 {
        order: 3;
        flex-direction: row-reverse !important; /* 👈 This line reverses image and name for Player 2 */
    }

    .player {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    .player img {
        width: 100px;
        height: 140px;
        margin-top: 0;
        border-radius: 10px;
    }

    .player button {
        font-size: 16px;
        padding: 6px 12px;
    }

    .board {
        grid-template-columns: repeat(3, 80px);
        grid-gap: 10px;
    }

    .cell {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }

    .container h2 {
        font-size: 24px;
        margin-bottom: 10px;
    }
}


@media (max-width: 480px) {
    .player img {
        width: 100px;
        height: 140px;
    }

    .board {
        grid-template-columns: repeat(3, 70px);
    }

    .cell {
        width: 70px;
        height: 70px;
        font-size: 35px;
    }
}

@media (max-width: 375px) {
    .player img {
        width: 80px;
        height: 110px;
    }

    .board {
        grid-template-columns: repeat(3, 60px);
    }

    .cell {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
}
