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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #FAFAFA;
    min-height: 100vh;
    color: #212121;
    line-height: 1.6;
}

/* 扁平化设计 - 主容器 */
.game-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
    background: #FFFFFF;
    min-height: 100vh;
}

/* 扁平化设计 - 标题区域 */
.game-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px 0;
    background: #2196F3;
    color: white;
    border-radius: 12px;
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    min-width: 80px;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* 扁平化设计 - 模式选择 */
.game-mode, .board-size {
    margin-bottom: 24px;
    text-align: center;
}

.game-mode h3, .board-size h3 {
    color: #424242;
    margin-bottom: 16px;
    font-size: 1.125rem;
    font-weight: 500;
}

.mode-buttons, .size-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    background: #F5F5F5;
    color: #424242;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 120px;
    font-weight: 500;
}

.mode-btn:hover {
    background: #E0E0E0;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: #2196F3;
    color: white;
}

.mode-btn span {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

.size-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    background: #F5F5F5;
    color: #424242;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.size-btn:hover {
    background: #E0E0E0;
}

.size-btn.active {
    background: #FF9800;
    color: white;
}

/* 扁平化设计 - 控制按钮 */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #4CAF50;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    min-width: 110px;
}

.btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.btn.secondary {
    background: #9E9E9E;
}

.btn.secondary:hover {
    background: #757575;
}

/* 扁平化设计 - 棋盘区域 */
.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.board-wrapper {
    position: relative;
    background: #FFF3E0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#goBoard {
    display: block;
    background: #FFF8E1;
    cursor: crosshair;
    border-radius: 8px;
}

/* 扁平化设计 - 游戏信息 */
.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.captured-stones, .game-status {
    background: #F8F9FA;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #2196F3;
}

.captured-stones h4, .game-status h4 {
    color: #2196F3;
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 600;
}

.captured-display, .status-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.captured-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.stone {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
}

.black-stone {
    background: #212121;
}

.white-stone {
    background: #FAFAFA;
    border: 2px solid #BDBDBD;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    color: #666;
    font-weight: 500;
}

/* 扁平化设计 - 弹窗 */
.game-over-popup, .help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over-popup.show, .help-modal.show {
    display: flex;
}

.popup-content, .modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.popup-content h2 {
    color: #2196F3;
    margin-bottom: 24px;
    font-size: 1.75rem;
    font-weight: 600;
}

.game-result {
    font-size: 1.25rem;
    color: #4CAF50;
    margin-bottom: 24px;
    font-weight: 600;
}

.final-score {
    display: flex;
    justify-content: space-around;
    margin-bottom: 32px;
    padding: 16px;
    background: #F8F9FA;
    border-radius: 8px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.popup-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* 帮助按钮 */
.help-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 28px;
    background: #2196F3;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    transition: all 0.2s ease;
}

.help-btn:hover {
    background: #1976D2;
    transform: scale(1.1);
}

/* 模态框 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #E0E0E0;
}

.modal-header h2 {
    color: #2196F3;
    font-size: 1.375rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9E9E9E;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: #F5F5F5;
    color: #424242;
}

.modal-body {
    text-align: left;
}

.help-section {
    margin-bottom: 24px;
}

.help-section h3 {
    color: #2196F3;
    margin-bottom: 12px;
    font-size: 1.125rem;
    font-weight: 600;
}

.help-section p {
    color: #666;
    margin-bottom: 12px;
}

.help-section ul {
    color: #666;
    margin-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 16px;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }
    
    .game-info {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .mode-buttons, .size-buttons {
        flex-direction: column;
        align-items: center;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .mode-btn {
        width: 100%;
    }
    
    #goBoard {
        width: 100%;
        height: auto;
        max-width: 350px;
        max-height: 350px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        min-width: 200px;
    }
    
    .popup-content, .modal-content {
        padding: 24px;
        margin: 16px;
    }
    
    .popup-actions {
        flex-direction: column;
    }
    
    .help-btn {
        bottom: 16px;
        right: 16px;
    }
}

@media (max-width: 480px) {
    .final-score {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .captured-display {
        align-items: center;
    }
}