* {
    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: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

h1 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2rem;
}

.mode-selector {
    margin-bottom: 20px;
}

.mode-selector h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #555;
}

.modes {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-width: 80px;
}

.mode-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.game-board {
    margin-bottom: 20px;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
    background: #ddd;
    border-radius: 10px;
    padding: 5px;
    width: 300px;
    height: 300px;
    margin: 0 auto;
}

.cell {
    background: white;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.cell:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.cell.x {
    color: #ff6b6b;
}

.cell.o {
    color: #4ecdc4;
}

.cell.winner {
    background: #ffe66d;
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.game-info {
    margin-bottom: 20px;
}

.status {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #555;
    min-height: 24px;
}

.scores {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.score {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 1rem;
    min-width: 80px;
}

.score .label {
    font-weight: bold;
    color: #666;
}

.score .value {
    color: #667eea;
    font-weight: bold;
    font-size: 1.1rem;
}

.restart-btn {
    padding: 12px 30px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.restart-btn:active {
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
        width: 95%;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .board {
        width: 250px;
        height: 250px;
    }
    
    .cell {
        font-size: 2rem;
    }
    
    .mode-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
        min-width: 70px;
    }
    
    .scores {
        gap: 5px;
    }
    
    .score {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-width: 70px;
    }
}

/* 胜利动画 */
@keyframes winAnimation {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

.win-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: winAnimation 0.3s ease;
}

.win-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    width: 90%;
}

.win-content h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.win-content p {
    margin-bottom: 20px;
    color: #555;
    font-size: 1.1rem;
}

.win-content button {
    padding: 10px 20px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.win-content button:hover {
    background: #764ba2;
    transform: translateY(-2px);
}