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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    backdrop-filter: blur(10px);
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-mode {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.mode-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #667eea;
    background: transparent;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

.mode-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.current-player {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4a5568;
}

.score {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.player-label {
    font-size: 0.9rem;
    color: #718096;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4a5568;
    background: #f7fafc;
    padding: 0.25rem 0.75rem;
    border-radius: 10px;
    min-width: 40px;
    text-align: center;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px;
    margin: 2rem auto;
    max-width: 300px;
    background: #f7fafc;
    padding: 15px;
    border-radius: 15px;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

.cell {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background: #edf2f7;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cell.x {
    color: #e53e3e;
    background: linear-gradient(45deg, #fed7d7, #feb2b2);
}

.cell.o {
    color: #3182ce;
    background: linear-gradient(45deg, #bee3f8, #90cdf4);
}

.cell.winning {
    animation: pulse 0.6s ease-in-out infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }
    to {
        transform: scale(1.05);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
    }
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.control-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.game-status {
    text-align: center;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    color: #4a5568;
    min-height: 1.5rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#modal-title {
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

#modal-message {
    color: #718096;
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.modal-btn:not(.secondary) {
    background: #667eea;
    color: white;
}

.modal-btn.secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-btn:not(.secondary):hover {
    background: #5a67d8;
}

.modal-btn.secondary:hover {
    background: #cbd5e0;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .game-mode {
        flex-direction: column;
        align-items: center;
    }

    .mode-btn {
        width: 100%;
        max-width: 200px;
    }

    .game-info {
        flex-direction: column;
        text-align: center;
    }

    .cell {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }

    .game-controls {
        flex-direction: column;
        align-items: center;
    }

    .control-btn {
        width: 100%;
        max-width: 200px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}

/* Additional animations */
.cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.cell:hover::before {
    left: 100%;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
