* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

.main {
    width: 100%;
    height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(https://images.unsplash.com/photo-1506744038136-46273834b3fb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8bW9kZXJuJTIwY2l0eXxlbnwwfHwwfHx8MA%3D%3D&auto=format&fit=crop&w=500&q=60);
    background-position: center;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 500px;
    height: auto;
    min-height: 80vh;
    /* background-color: #fff; */
    /* border: 3px solid red; */
}

.score-board {
    width: 100%;
    height: auto;
    min-height: 10%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: clamp(1rem, 4vw, 2rem);
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.player-score {
    text-align: center;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0.5rem;
    border: 1px solid #333;
}

.game-status {
    width: 100%;
    height: auto;
    min-height: 10%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0.5rem;
    border: 1px solid #333;
}

.game-board {
    width: 100%;
    overflow: hidden;
    height: 70vh;
    max-height: 400px;
    border: 2px solid black;
    border-radius: 1rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    background-color: rgba(255, 255, 255, 0.9);
    /* gap: 2px; */
    /* padding: 2px; */
    margin-bottom: 1rem;
}

.cell {
    background-color: #f0f0f0;
    border: 1px solid #070707;
    display: flex;
    border-radius: 0.2rem;
    justify-content: center;
    align-items: center;
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cell:hover {
    background-color: #726d6d;
    /* transform: scale(1.05); */
}
/* ye  jo hai js ki help se ho raha hai  */
.cell.x {
    color: #b91616;
}

.cell.o {
    color: #2970da;
}

.cell.winning {
    background-color: #4CAF50;
    color: white;
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.game-btn {
    width: 100%;
    height: auto;
    min-height: 10%;
    font-size: clamp(1rem, 3vw, 1.5rem);
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

#resetBtn {
    width: 45%;
    min-width: 120px;
    height: 3rem;
    border-radius: 0.5rem;
    outline: none;
    /* font-size: 3rem; */
    cursor: pointer;
    border: 2px solid black;
    background-color: #b91616;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
}

#resetBtn:hover {
    background-color: #df7272;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#resetBtn:active {
    background-color: #df7272;
    color: white;
    scale: 0.98;
    transform: translateY(0);
}

#newGameBtn {
    width: 45%;
    min-width: 120px;
    height: 3rem;
    border-radius: 0.5rem;
    cursor: pointer;
    outline: none;
    border: 2px solid black;
    background-color: #2970da;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
}

#newGameBtn:hover {
    background-color: #6db0d6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#newGameBtn:active {
    background-color: #77a2be;
    scale: 0.98;
    transform: translateY(0);
}

/* Responsive Design for different screen sizes */
@media (max-width: 768px) {
    .main {
        padding: 0.5rem;
    }
    
    .container {
        min-height: 90vh;
    }
    
    .game-board {
        height: 60vh;
        max-height: 350px;
    }
    
    .cell {
        font-size: clamp(1.5rem, 6vw, 3rem);
    }
    
    .score-board {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .player-score {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 0.25rem;
    }
    
    .container {
        min-height: 95vh;
    }
    
    .game-board {
        height: 50vh;
        max-height: 300px;
        border-radius: 0.5rem;
    }
    
    .cell {
        font-size: clamp(1.2rem, 5vw, 2.5rem);
        border-radius: 0.1rem;
    }
    
    .game-btn {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #resetBtn,
    #newGameBtn {
        width: 80%;
        height: 2.5rem;
    }
    
    .score-board {
        margin-bottom: 0.5rem;
    }
    
    .game-status {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 320px) {
    .game-board {
        height: 45vh;
        max-height: 250px;
    }
    
    .cell {
        font-size: clamp(1rem, 4vw, 2rem);
    }
    
    .score-board {
        font-size: clamp(0.8rem, 3vw, 1.2rem);
    }
    
    .game-status {
        font-size: clamp(0.8rem, 3vw, 1.2rem);
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .main {
        padding: 0.25rem;
    }
    
    .container {
        min-height: 95vh;
    }
    
    .game-board {
        height: 50vh;
        max-height: 250px;
    }
    
    .score-board {
        height: auto;
        min-height: auto;
        margin-bottom: 0.5rem;
    }
    
    .game-status {
        height: auto;
        min-height: auto;
        margin-bottom: 0.5rem;
    }
    
    .game-btn {
        height: auto;
        min-height: auto;
    }
}