/* Enhanced Tic Tac Toe with Background Graphics */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --x-color: #e74c3c;
    --o-color: #3498db;
    --win-color: #2ecc71;
    --text-color: #ecf0f1;
    --bg-color: #1a1a1a;
    --cell-bg: rgba(52, 73, 94, 0.7);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    z-index: -2;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Particle Background */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-1000px) rotate(720deg); opacity: 0; }
}

/* Game Container */
.game-container {
    max-width: 500px;
    width: 100%;
    text-align: center;
    background: rgba(44, 62, 80, 0.85);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    animation: rotate 20s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

h1 {
    margin-top: 0;
    font-size: 2.5rem;
    color: var(--text-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 25%;
    width: 50%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--win-color), transparent);
    border-radius: 3px;
}

/* Board Styles */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 2rem auto;
    max-width: 300px;
    position: relative;
}

.board::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    z-index: -1;
    animation: pulseBorder 3s infinite alternate;
}

@keyframes pulseBorder {
    0% { border-color: rgba(255, 255, 255, 0.1); }
    100% { border-color: rgba(255, 255, 255, 0.3); }
}

.cell {
    aspect-ratio: 1/1;
    background: var(--cell-bg);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cell:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    background: rgba(52, 73, 94, 0.9);
}

.cell.x {
    color: var(--x-color);
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.cell.o {
    color: var(--o-color);
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.cell.win {
    background-color: var(--win-color);
    animation: pulse 1s infinite alternate;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

@keyframes pulse {
    from { transform: scale(1); box-shadow: 0 0 0 rgba(46, 204, 113, 0.4); }
    to { transform: scale(1.05); box-shadow: 0 0 20px rgba(46, 204, 113, 0.8); }
}

/* Status Message */
.status {
    font-size: 1.5rem;
    margin: 1rem 0;
    font-weight: bold;
    min-height: 2rem;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.status.winner {
    color: var(--win-color);
    transform: scale(1.1);
    animation: textGlow 1.5s infinite alternate;
}

@keyframes textGlow {
    from { text-shadow: 0 0 5px rgba(46, 204, 113, 0.5); }
    to { text-shadow: 0 0 15px rgba(46, 204, 113, 0.8); }
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.reset-btn {
    background: rgba(52, 73, 94, 0.7);
    color: var(--text-color);
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.reset-btn:hover {
    background: var(--win-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.reset-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    transition: all 0.3s ease;
}

.reset-btn:hover::after {
    left: 100%;
}

/* Scoreboard */
.scoreboard {
    display: flex;
    gap: 1rem;
}

.score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.player-icon {
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.x-score .player-icon {
    color: var(--x-color);
}

.o-score .player-icon {
    color: var(--o-color);
}

.score-count {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Animations */
@keyframes appear {
    from { transform: scale(0) rotate(0deg); opacity: 0; }
    to { transform: scale(1) rotate(360deg); opacity: 1; }
}

.cell.x::before, .cell.o::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    animation: appear 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 500px) {
    .game-container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .status {
        font-size: 1.2rem;
    }
    
    .cell {
        font-size: 2.5rem;
    }
}