:root {
    --bg-color: #050505;
    --neon-cyan: #00f3ff;
    --neon-magenta: #ff00ff;
    --grid-line: rgba(0, 243, 255, 0.3);
    --text-color: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.system-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Header & Typography */
.glitch-text {
    font-size: 3rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.status-display {
    margin-top: 1rem;
    font-size: 1.2rem;
    text-align: center;
    color: var(--neon-magenta);
    text-shadow: 0 0 5px var(--neon-magenta);
    height: 24px;
}

/* Toggle Switch */
.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid var(--grid-line);
}

.mode-label {
    font-weight: bold;
    color: var(--text-color);
}

.ai-label { color: var(--neon-magenta); }

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: transparent;
    border: 2px solid var(--neon-cyan);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: var(--neon-cyan);
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-cyan);
}

input:checked + .slider {
    border-color: var(--neon-magenta);
}

input:checked + .slider:before {
    background-color: var(--neon-magenta);
    box-shadow: 0 0 10px var(--neon-magenta);
    transform: translateX(30px);
}

/* Game Board */
.board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 5px;
    background-color: var(--grid-line);
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    padding: 5px;
    border-radius: 10px;
}

.cell {
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
    border-radius: 5px;
}

.cell:hover {
    background-color: rgba(0, 243, 255, 0.1);
    box-shadow: inset 0 0 15px var(--grid-line);
}

/* X and O Animations */
.cell.x {
    color: var(--neon-cyan);
    text-shadow: 0 0 15px var(--neon-cyan);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cell.o {
    color: var(--neon-magenta);
    text-shadow: 0 0 15px var(--neon-magenta);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Custom CSS Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #111;
    border: 2px solid var(--neon-cyan);
    padding: 3rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.3);
    transform: translateY(-50px) scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}

#modal-message {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cyber-btn {
    background: transparent;
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    padding: 12px 24px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 5px;
    text-transform: uppercase;
}

.cyber-btn:hover {
    background: var(--neon-cyan);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--neon-cyan);
}