@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

/* --- Animated Background Start --- */
.area{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #4e54c8;  
    background: -webkit-linear-gradient(to left, #8f94fb, #4e54c8);  
    z-index: -1; /* Peechay rahay */
}

.circles{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.circles li{
    position: absolute;
    display: block;
    list-style: none;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    animation: animate 25s linear infinite;
    bottom: -150px;
}
/* Alag alag sizes aur positions ke liye */
.circles li:nth-child(1){ left: 25%; width: 80px; height: 80px; animation-delay: 0s; }
.circles li:nth-child(2){ left: 10%; width: 20px; height: 20px; animation-delay: 2s; animation-duration: 12s; }
.circles li:nth-child(3){ left: 70%; width: 20px; height: 20px; animation-delay: 4s; }
.circles li:nth-child(4){ left: 40%; width: 60px; height: 60px; animation-delay: 0s; animation-duration: 18s; }
.circles li:nth-child(5){ left: 65%; width: 20px; height: 20px; animation-delay: 0s; }
.circles li:nth-child(6){ left: 75%; width: 110px; height: 110px; animation-delay: 3s; }
.circles li:nth-child(7){ left: 35%; width: 150px; height: 150px; animation-delay: 7s; }
.circles li:nth-child(8){ left: 50%; width: 25px; height: 25px; animation-delay: 15s; animation-duration: 45s; }
.circles li:nth-child(9){ left: 20%; width: 15px; height: 15px; animation-delay: 2s; animation-duration: 35s; }
.circles li:nth-child(10){ left: 85%; width: 150px; height: 150px; animation-delay: 0s; animation-duration: 11s; }

@keyframes animate {
    0%{ transform: translateY(0) rotate(0deg); opacity: 1; border-radius: 0; }
    100%{ transform: translateY(-1000px) rotate(720deg); opacity: 0; border-radius: 50%; }
}
/* --- Animated Background End --- */


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

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0f0c29; 
    overflow-x: hidden; /* Mobile par side scroll na aaye */
    padding: 20px;
}

/* Animated Background (Slightly optimized) */
.area {
    position: fixed; /* Fixed taakay scroll par masla na ho */
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to left, #24243e, #302b63, #0f0c29);
    z-index: -1;
}

.main-container {
    width: 100%;
    max-width: 450px; /* Bara screen size */
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    padding: clamp(15px, 5vw, 30px); /* Responsive Padding */
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

h1 {
    color: #fff;
    font-size: clamp(1.5rem, 8vw, 2.5rem); /* Text screen ke sath chota hoga */
    margin-bottom: 15px;
    text-shadow: 0 0 10px #00d2ff;
}

#msg-container {
    color: #ffd700;
    font-size: clamp(1rem, 5vw, 1.4rem);
    margin-bottom: 20px;
    font-weight: bold;
    min-height: 40px;
}

/* Game Board - Dynamic Grid */
.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 barabar ke columns */
    gap: clamp(8px, 2vw, 15px);
    margin: 0 auto 25px auto;
}

.box {
    aspect-ratio: 1/1; /* Box hamesha square rahay ga */
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: clamp(10px, 3vw, 20px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(2.5rem, 12vw, 4rem); /* X aur O ka size responsive */
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.box:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

/* X and O Colors */
.x-mark { color: #ff3860; text-shadow: 0 0 15px #ff3860; }
.o-mark { color: #00d1b2; text-shadow: 0 0 15px #00d1b2; }

/* Winner Highlighting */
.win-box {
    background: rgba(255, 215, 0, 0.2) !important;
    border: 2px solid #ffd700 !important;
    animation: winPulse 0.8s infinite alternate;
}

@keyframes winPulse {
    from { transform: scale(1); box-shadow: 0 0 10px #ffd700; }
    to { transform: scale(1.05); box-shadow: 0 0 30px #ffd700; }
}

#reset-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    background: linear-gradient(45deg, #00d2ff, #3a7bd5);
    border: none;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
}

#reset-btn:hover {
    filter: brightness(1.2);
    letter-spacing: 2px;
}

/* --- Mobile Specific Tweaks --- */
@media (max-width: 400px) {
    .main-container {
        padding: 15px;
    }
    .game-board {
        gap: 8px;
    }
}