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

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1a1a1a;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* 点击区域 */
.click-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none;
}

/* 全屏棋盘容器 */
.board-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
}

.board {
    width: 100vmin;
    height: 100vmin;
    max-width: 800px;
    max-height: 800px;
    background: linear-gradient(135deg, #DEB887 0%, #D2B48C 100%);
    border: 3px solid #8B4513;
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(139, 69, 19, 0.3);
    transition: all 0.3s ease;
}

.board:hover {
    box-shadow: 0 12px 48px rgba(139, 69, 19, 0.4);
}

/* 创建棋盘格子线 */
.board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(to right, rgba(139, 69, 19, 0.8) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(139, 69, 19, 0.8) 1px, transparent 1px);
    background-size: calc(100% / 14) calc(100% / 14);
    pointer-events: none;
    z-index: 1;
}

/* 为交叉点创建棋子容器 */
.board .cell {
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 2;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 修改棋子样式，使其显示在交叉点上 */
.board .cell::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    z-index: 3;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 为交叉点添加视觉标记 */
.board .cell::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(139, 69, 19, 0.3);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: all 0.2s ease;
}

/* 为中心交叉点添加特殊标记 */
.board .cell[data-x="7"][data-y="7"]::before {
    background-color: rgba(139, 69, 19, 0.6);
    width: 8px;
    height: 8px;
}

.board .cell:hover::before {
    transform: translate(-50%, -50%) scale(1.2);
    background-color: rgba(139, 69, 19, 0.4);
}

.board .cell.black::after {
    background: radial-gradient(circle at 30% 30%, #333, #000);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    animation: placePiece 0.3s ease-out;
}

.board .cell.white::after {
    background: radial-gradient(circle at 30% 30%, #fff, #f0f0f0);
    border: 1px solid #ddd;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    animation: placePiece 0.3s ease-out;
}

@keyframes placePiece {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 半透明控制按钮 */
.game-controls-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    flex-direction: column;
    z-index: 100;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.game-controls-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

.control-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 16px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.control-btn:hover::before {
    left: 100%;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    background: rgba(76, 175, 80, 1);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.btn-icon {
    font-size: 24px;
    line-height: 1;
}

/* 游戏状态 */
.game-status-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 100;
    min-width: 200px;
    transition: all 0.3s ease;
}

.game-status-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

#current-player {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 16px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#game-message {
    min-height: 24px;
    margin-top: 8px;
    color: #4CAF50;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 游戏设置 */
.game-settings-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transition: all 0.3s ease;
}

.game-settings-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

#difficulty {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 120px;
}

#difficulty:hover {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

#difficulty:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 24px;
    border: none;
    width: 80%;
    max-width: 500px;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

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

.close {
    color: #999;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #333;
    transform: scale(1.1);
}

.modal-content h2 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

#history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 16px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

#history-list::-webkit-scrollbar {
    width: 6px;
}

#history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#history-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#history-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.history-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.history-item:hover {
    background-color: #f9f9f9;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .winner {
    font-weight: 600;
    color: #4CAF50;
    font-size: 14px;
}

.history-item .details {
    font-size: 12px;
    color: #777;
    margin-top: 6px;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .board {
        max-width: 90vmin;
        max-height: 90vmin;
    }
    
    .game-controls-overlay {
        top: 12px;
        right: 12px;
        padding: 8px;
        border-radius: 12px;
    }
    
    .control-btn {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }
    
    .btn-icon {
        font-size: 20px;
    }
    
    .game-status-overlay {
        top: 12px;
        left: 12px;
        padding: 12px;
        border-radius: 12px;
        min-width: 160px;
    }
    
    #current-player {
        font-size: 14px;
    }
    
    #game-message {
        font-size: 12px;
    }
    
    .game-settings-overlay {
        bottom: 12px;
        padding: 8px;
        border-radius: 12px;
    }
    
    #difficulty {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .board {
        max-width: 95vmin;
        max-height: 95vmin;
    }
    
    .game-controls-overlay {
        top: 8px;
        right: 8px;
        padding: 6px;
        border-radius: 10px;
    }
    
    .control-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }
    
    .btn-icon {
        font-size: 18px;
    }
    
    .game-status-overlay {
        top: 8px;
        left: 8px;
        padding: 10px;
        border-radius: 10px;
        min-width: 140px;
    }
    
    #current-player {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    #game-message {
        font-size: 10px;
    }
    
    .game-settings-overlay {
        bottom: 8px;
        padding: 6px;
        border-radius: 10px;
    }
    
    #difficulty {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 80px;
    }
    
    .modal-content {
        width: 95%;
        margin: 40% auto;
        padding: 20px;
        border-radius: 16px;
    }
    
    .modal-content h2 {
        font-size: 18px;
        margin-bottom: 16px;
    }
}