:root {
    --primary-color: #7c5cff;
    --primary-hover: #9172ff;
    --x-color: #ff5454;
    --o-color: #54c7ff;
    --dark-bg: #151a30;
    --card-bg: #1e2642;
    --text-primary: #e6e9f4;
    --text-secondary: #a0a8c7;
    --border-radius: 12px;
    --box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    --cell-bg: #252d4a;
    --cell-hover: #303a5f;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

#gameContainer {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.game-title {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 5px;
    font-weight: 700;
    text-shadow: 0 2px 5px rgba(124, 92, 255, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.game-info {
    margin-bottom: 20px;
    transition: opacity 0.5s ease;
}

.rules {
    background-color: rgba(124, 92, 255, 0.15);
    padding: 15px;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.4;
    border-left: 3px solid var(--primary-color);
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.players-container {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.player.active {
    opacity: 1;
    transform: scale(1.05);
}

.player-x {
    color: var(--x-color);
}

.player-o {
    color: var(--o-color);
}

.player-icon {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(30, 38, 66, 0.9);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    border: 2px solid;
}

.notification.x-move {
    border-color: var(--x-color);
}

.notification.o-move {
    border-color: var(--o-color);
}

.notification.show {
    opacity: 1;
    visibility: visible;
    animation: notificationAnimation 1.5s ease;
}

.notification-text {
    font-size: 1.2rem;
    font-weight: 600;
}

@keyframes notificationAnimation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

#cellContainer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 12px;
    margin: 30px auto;
    max-width: 330px;
}

.cell {
    aspect-ratio: 1/1;
    background-color: var(--cell-bg);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.cell:hover {
    background-color: var(--cell-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.cell:active {
    transform: translateY(0);
}

.status-text {
    font-size: 1.5rem;
    margin: 20px 0;
    font-weight: 600;
    color: var(--primary-color);
    min-height: 50px;
}

.restart-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(124, 92, 255, 0.4);
}

.restart-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(124, 92, 255, 0.5);
}

.restart-btn:active {
    transform: translateY(0);
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    #gameContainer {
        padding: 20px 15px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .cell {
        font-size: 2rem;
    }
    
    .status-text {
        font-size: 1.3rem;
    }
}

/* Animation for cell content */
.cell:not(:empty) {
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Glow effect for X and O */
.cell:has(:-webkit-any(:not(:empty)):nth-child(odd)) {
    color: var(--x-color);
    box-shadow: 0 0 15px rgba(255, 84, 84, 0.2);
}

.cell:has(:-webkit-any(:not(:empty)):nth-child(even)) {
    color: var(--o-color);
    box-shadow: 0 0 15px rgba(84, 199, 255, 0.2);
}

/* Restart animation */
@keyframes restart {
    0% {
        transform: scale(0.98);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.01);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.restart-animation {
    animation: restart 0.5s ease;
}