* {
    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;
    color: #333;
    /* 移动端优化 */
    overflow-x: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1em;
}

.black-player {
    background: linear-gradient(45deg, #2c3e50, #34495e);
    color: white;
}

.white-player {
    background: linear-gradient(45deg, #ecf0f1, #bdc3c7);
    color: #2c3e50;
}

.player-icon {
    font-size: 1.5em;
}

.vs {
    font-size: 1.2em;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.game-status {
    text-align: center;
}

#currentPlayer {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

#gameResult {
    font-size: 1.1em;
    font-weight: bold;
    min-height: 25px;
}

.winner-black {
    color: #2c3e50;
}

.winner-white {
    color: #7f8c8d;
}

.winner-draw {
    color: #f39c12;
}

/* 游戏主体 */
.game-main {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.board-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#gameBoard {
    display: block;
    cursor: crosshair;
    border-radius: 10px;
}

#pieces {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 600px;
    height: 600px;
    pointer-events: none;
}

.piece {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.piece.black {
    background: radial-gradient(circle at 30% 30%, #555, #000);
    border: 2px solid #333;
}

.piece.white {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
    border: 2px solid #999;
}

.piece.highlight {
    box-shadow: 0 0 15px #f39c12, 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%) scale(1.1);
}

.piece.hint {
    background: radial-gradient(circle at 30% 30%, #3498db, #2980b9);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* 游戏控制 */
.game-controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

.control-btn {
    width: 100%;
    padding: 12px 20px;
    margin-bottom: 15px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.difficulty-selector {
    margin-top: 20px;
}

.difficulty-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
}

.difficulty-selector select {
    width: 100%;
    padding: 10px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
}

.difficulty-selector select:focus {
    outline: none;
    border-color: #3498db;
}

/* 游戏规则 */
.game-footer {
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.rules h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.rules ul {
    list-style: none;
    padding-left: 0;
}

.rules li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #34495e;
    line-height: 1.5;
}

.rules li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-header {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .game-header h1 {
        font-size: 2em;
        margin-bottom: 15px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .player {
        font-size: 1em;
        padding: 8px 12px;
    }
    
    .game-main {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .board-container {
        padding: 15px;
    }
    
    #gameBoard {
        width: 400px;
        height: 400px;
    }
    
    #pieces {
        width: 400px;
        height: 400px;
    }
    
    .piece {
        width: 20px;
        height: 20px;
    }
    
    .game-controls {
        width: 100%;
        max-width: 400px;
        padding: 15px;
    }
    
    .control-btn {
        padding: 15px 20px;
        font-size: 1.2em;
        margin-bottom: 12px;
        /* 增大触摸区域 */
        min-height: 50px;
    }
    
    .difficulty-selector select {
        padding: 12px;
        font-size: 1.1em;
    }
    
    .game-footer {
        margin-top: 20px;
        padding: 15px;
    }
    
    .rules h3 {
        font-size: 1.2em;
    }
    
    .rules li {
        font-size: 0.95em;
        padding: 6px 0;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 8px;
    }
    
    .game-header {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .game-header h1 {
        font-size: 1.8em;
        margin-bottom: 12px;
    }
    
    .board-container {
        padding: 10px;
    }
    
    #gameBoard {
        width: 300px;
        height: 300px;
    }
    
    #pieces {
        width: 300px;
        height: 300px;
    }
    
    .piece {
        width: 15px;
        height: 15px;
    }
    
    .game-controls {
        padding: 12px;
    }
    
    .control-btn {
        padding: 12px 16px;
        font-size: 1.1em;
        min-height: 45px;
    }
    
    .game-footer {
        padding: 12px;
    }
    
    .rules h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    .rules li {
        font-size: 0.9em;
        padding: 5px 0;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    #gameBoard {
        width: 280px;
        height: 280px;
    }
    
    #pieces {
        width: 280px;
        height: 280px;
    }
    
    .piece {
        width: 12px;
        height: 12px;
    }
    
    .game-header h1 {
        font-size: 1.6em;
    }
    
    .control-btn {
        font-size: 1em;
        padding: 10px 14px;
        min-height: 42px;
    }
}

/* 横屏模式优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .game-container {
        padding: 5px;
    }
    
    .game-header {
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .game-header h1 {
        font-size: 1.5em;
        margin-bottom: 8px;
    }
    
    .game-main {
        flex-direction: row;
        gap: 15px;
        justify-content: center;
        align-items: flex-start;
    }
    
    .board-container {
        padding: 10px;
    }
    
    #gameBoard {
        width: 350px;
        height: 350px;
    }
    
    #pieces {
        width: 350px;
        height: 350px;
    }
    
    .game-controls {
        max-width: 180px;
        padding: 10px;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 0.95em;
        margin-bottom: 8px;
        min-height: 36px;
    }
    
    .game-footer {
        margin-top: 10px;
        padding: 10px;
    }
    
    .rules h3 {
        font-size: 1em;
        margin-bottom: 8px;
    }
    
    .rules li {
        font-size: 0.85em;
        padding: 3px 0;
    }
}