:root {
    --neon-blue: #08f;
    --neon-pink: #f0f;
    --neon-purple: #90f;
    --neon-yellow: #ff0;
    --neon-green: #0f0;
    --dark-bg: #111;
}

body {
    background-color: var(--dark-bg);
    color: white;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    position: relative;
}

.dynamic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(45deg, #0f0f0f, #1a1a1a);
    overflow: hidden;
}

.dynamic-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 136, 255, 0.1) 0%, transparent 70%);
    animation: pulse 15s infinite alternate;
}

.dynamic-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(90deg, transparent 48%, rgba(255, 0, 255, 0.05) 49%, rgba(255, 0, 255, 0.05) 51%, transparent 52%),
        linear-gradient(0deg, transparent 48%, rgba(255, 0, 255, 0.05) 49%, rgba(255, 0, 255, 0.05) 51%, transparent 52%);
    background-size: 50px 50px;
    opacity: 0.3;
}

@keyframes pulse {
    0% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(10%, 10%);
    }
    50% {
        transform: translate(5%, -5%);
    }
    75% {
        transform: translate(-5%, 5%);
    }
    100% {
        transform: translate(-10%, -10%);
    }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: rgba(0, 0, 0, 0.7);
    border: 3px solid var(--neon-purple);
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 20px var(--neon-purple);
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.container {
    text-align: center;
    padding: 20px;
    max-width: 600px;
    width: 100%;
}

h1.neon, h2.neon {
    color: #fff;
    text-shadow: 0 0 10px var(--neon-blue), 
                 0 0 20px var(--neon-blue), 
                 0 0 30px var(--neon-purple);
    font-size: 2rem;
    margin-bottom: 30px;
    animation: flicker 1.5s infinite alternate;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 0 0 10px var(--neon-blue),
                     0 0 20px var(--neon-blue),
                     0 0 30px var(--neon-purple);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

.neon-btn {
    background: transparent;
    color: var(--neon-yellow);
    border: 3px solid var(--neon-yellow);
    padding: 15px 25px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 10px var(--neon-yellow), 
                inset 0 0 10px var(--neon-yellow);
    text-shadow: 0 0 5px var(--neon-yellow);
    width: 100%;
}

.neon-btn:hover {
    background: var(--neon-yellow);
    color: var(--dark-bg);
    box-shadow: 0 0 20px var(--neon-yellow), 
                inset 0 0 20px var(--neon-yellow);
}

.neon-btn:active {
    transform: scale(0.95);
}

.scoreboard {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.score {
    font-size: 1rem;
    padding: 10px;
    border-radius: 5px;
    margin: 5px;
}

#player1-score {
    color: var(--neon-blue);
    text-shadow: 0 0 5px var(--neon-blue);
}

#player2-score {
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
}

.game-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    width: 300px;
    height: 300px;
}

.cell {
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.cell:hover {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 15px var(--neon-yellow);
}

.cell.x {
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

.cell.o {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}

.cell.x::before, .cell.x::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 10px;
    background-color: var(--neon-blue);
    transform: rotate(45deg);
    box-shadow: 0 0 10px var(--neon-blue);
}

.cell.x::after {
    transform: rotate(-45deg);
}

.cell.o::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    border: 10px solid var(--neon-pink);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-pink);
}

.status {
    font-size: 1.2rem;
    margin-bottom: 20px;
    min-height: 30px;
    color: var(--neon-yellow);
    text-shadow: 0 0 5px var(--neon-yellow);
}

.winner {
    animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.1);
    }
}

.name-input {
    margin: 15px 0;
}

.name-input label {
    display: block;
    margin-bottom: 8px;
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
    font-size: 0.8rem;
}

.name-input input {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-purple);
    color: white;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    box-shadow: 0 0 10px var(--neon-purple);
}

.name-input input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 15px var(--neon-blue);
}

.game-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.game-buttons .neon-btn {
    flex: 1;
}

@media (max-width: 600px) {
    h1.neon, h2.neon {
        font-size: 1.5rem;
    }
    
    .grid {
        width: 250px;
        height: 250px;
    }
    
    .neon-btn {
        padding: 10px 15px;
        font-size: 0.7rem;
    }
    
    .score {
        font-size: 0.8rem;
    }
    
    .status {
        font-size: 1rem;
    }
}