* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(45deg, #2c3e50, #3498db);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.current-player {
    font-size: 1.2em;
    font-weight: bold;
}

.current-player span {
    padding: 5px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
}

.game-status {
    font-size: 1.1em;
    font-weight: bold;
}

.game-controls {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
}

.game-mode {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-mode label {
    font-weight: bold;
    color: #2c3e50;
}

.game-mode select {
    padding: 8px 12px;
    border: 2px solid #3498db;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.rules {
    display: flex;
    gap: 20px;
}

.rules label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #2c3e50;
}

.rules input[type="checkbox"] {
    transform: scale(1.2);
}

.buttons {
    display: flex;
    gap: 10px;
}

.buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#newGameBtn {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
}

#undoBtn {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
}

#resetBtn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
}

.buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.game-board-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
}

#gameBoard {
    background: linear-gradient(45deg, #deb887, #d2b48c);
    border: 3px solid #8b4513;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.game-history {
    padding: 20px;
    background: white;
    border-top: 1px solid #dee2e6;
    max-height: 200px;
    overflow-y: auto;
}

.game-history h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

#moveHistory {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.move-item {
    background: #e3f2fd;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    border: 1px solid #2196f3;
}

.move-item.black {
    background: #333;
    color: white;
}

.move-item.white {
    background: #f5f5f5;
    color: #333;
    border-color: #999;
}

.opening-info {
    padding: 20px;
    background: #fff3e0;
    border-top: 1px solid #ffcc02;
}

.opening-info h3 {
    color: #e65100;
    margin-bottom: 10px;
}

#openingName {
    font-size: 1.2em;
    font-weight: bold;
    color: #bf360c;
    margin-bottom: 10px;
}

#openingMoves {
    font-size: 14px;
    color: #d84315;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 2em;
}

.modal-content p {
    color: #7f8c8d;
    margin-bottom: 25px;
    font-size: 1.1em;
}

#newGameModalBtn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#newGameModalBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    #gameBoard {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    .rules {
        flex-direction: column;
        gap: 10px;
    }
    
    .buttons {
        justify-content: center;
    }
}

/* 棋子动画效果 */
@keyframes piecePlace {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.piece-animation {
    animation: piecePlace 0.3s ease-out;
}

/* 获胜高亮效果 */
@keyframes winHighlight {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.win-highlight {
    animation: winHighlight 0.8s ease-in-out infinite;
}
