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

:root {
    --primary-bg: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    --secondary-bg: #2d3e50;
    --cell-bg: rgba(255, 255, 255, 0.08);
    --cell-hover-bg: rgba(255, 255, 255, 0.15);
    --x-color: #ff5252; /* Vibrant Red */
    --o-color: #4fc3f7; /* Bright Blue */
    --text-color: #e0e0e0;
    --accent-color: #fdd835; /* Gold */
    --winning-cell-bg: rgba(255, 255, 255, 0.3); /* Slightly transparent white */
    --winning-cell-border: #fdd835;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}

body {
    background: var(--primary-bg);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-header {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent-color);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 1.5rem;
}

.game-info-section {
    margin-bottom: 1rem;
}

.game-status {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.game-cell {
    width: 100px;
    height: 100px;
    background: var(--cell-bg);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    user-select: none; /* Prevent text selection */
}

.game-cell:hover {
    background: var(--cell-hover-bg);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.game-cell.winning-cell {
    background: var(--winning-cell-bg);
    border: 3px solid var(--winning-cell-border);
    box-shadow: 0 0 20px var(--winning-cell-border), inset 0 0 10px var(--winning-cell-border);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(1.05); opacity: 0.9; }
}

.game-cell.x-mark {
    color: var(--x-color);
    text-shadow: 0 0 15px var(--x-color);
}

.game-cell.o-mark {
    color: var(--o-color);
    text-shadow: 0 0 15px var(--o-color);
}

.reset-button {
    background: linear-gradient(45deg, #00c6ff, #0072ff);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.reset-button:hover {
    background: linear-gradient(45deg, #0072ff, #00c6ff);
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

.reset-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.game-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: auto; /* Pushes footer to the bottom */
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 2rem;
    }

    .game-status {
        font-size: 1.5rem;
    }

    .game-board {
        grid-template-columns: repeat(3, 90px);
        grid-template-rows: repeat(3, 90px);
        gap: 8px;
        padding: 12px;
    }

    .game-cell {
        width: 90px;
        height: 90px;
        font-size: 3.5rem;
    }

    .reset-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.8rem;
    }

    .game-status {
        font-size: 1.3rem;
    }

    .game-board {
        grid-template-columns: repeat(3, 80px);
        grid-template-rows: repeat(3, 80px);
        gap: 6px;
        padding: 10px;
    }

    .game-cell {
        width: 80px;
        height: 80px;
        font-size: 3rem;
        border-radius: 10px;
    }

    .reset-button {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
}