/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 游戏容器 */
.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
    text-align: center;
}

/* 游戏标题 */
.game-title {
    font-size: 3em;
    color: #2c3e50;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

/* 设置面板 */
.settings-panel {
    margin-bottom: 30px;
}

.setting-group {
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.setting-group label {
    font-size: 1.1em;
    font-weight: bold;
    color: #34495e;
}

select {
    padding: 8px 15px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

select:focus {
    outline: none;
    border-color: #3498db;
}

/* 按钮样式 */
.toggle-btn, .start-btn, .control-btn, .modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.toggle-btn {
    background: #3498db;
    color: white;
    min-width: 80px;
}

.toggle-btn.off {
    background: #e74c3c;
}

.start-btn {
    background: #27ae60;
    color: white;
    padding: 12px 30px;
    font-size: 1.1em;
    margin-top: 10px;
}

.start-btn:hover {
    background: #219a52;
    transform: translateY(-2px);
}

.control-btn {
    background: #95a5a6;
    color: white;
    margin: 0 5px;
}

.control-btn:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.modal-btn {
    background: #3498db;
    color: white;
    margin: 0 10px;
    padding: 8px 20px;
}

.modal-btn:hover {
    background: #2980b9;
}

/* 游戏信息栏 */
.game-info {
    margin-bottom: 20px;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ecf0f1;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.player {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-name {
    font-size: 1.2em;
    font-weight: bold;
}

.black-player .player-name {
    color: #2c3e50;
}

.white-player .player-name {
    color: #7f8c8d;
}

.game-status {
    font-size: 1.3em;
    font-weight: bold;
    color: #e74c3c;
}

/* 计时器样式 */
.timer {
    position: relative;
    width: 60px;
    height: 60px;
}

.timer-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #34495e;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.timer-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e74c3c;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 1s linear;
    transform-origin: center;
}

.timer-text {
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    z-index: 1;
}

.timer.active .timer-fill {
    transform: scale(1);
}

.timer.warning .timer-fill {
    background: #f39c12;
}

.timer.danger .timer-fill {
    background: #e74c3c;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 棋盘容器 */
.board-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

#chessBoard {
    border: 2px solid #8b4513;
    background: #deb887;
    border-radius: 5px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* 控制按钮区域 */
.control-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* 模态框样式 */
.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: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 2em;
}

.modal-content p {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #34495e;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        margin: 20px;
        padding: 20px;
    }
    
    .game-title {
        font-size: 2em;
    }
    
    #chessBoard {
        width: 100%;
        height: auto;
        max-width: 400px;
    }
    
    .player-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .control-buttons {
        flex-wrap: wrap;
    }
}

/* 棋子落子动画 */
@keyframes pieceDrop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.piece-animation {
    animation: pieceDrop 0.3s ease-out;
}

/* 胜利连线动画 */
@keyframes winLine {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.win-line {
    stroke: #e74c3c;
    stroke-width: 3;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: winLine 1s ease-out forwards;
}